From c7e89630eb494454c1322bdf4cf29ab076af7b86 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 001/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From abc2415b5bd78366b9aa81b73c35b37812b95458 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 09:51:01 +0000 Subject: [PATCH 002/469] revert c7e89630eb494454c1322bdf4cf29ab076af7b86 revert Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 -- Marco.Pms.Model/Directory/Contact.cs | 31 --- .../Directory/ContactBucketMapping.cs | 18 -- .../Directory/ContactCategoryMaster.cs | 11 -- Marco.Pms.Model/Directory/ContactEmail.cs | 21 --- Marco.Pms.Model/Directory/ContactNote.cs | 25 --- Marco.Pms.Model/Directory/ContactPhone.cs | 22 --- .../Directory/ContactTagMapping.cs | 11 -- Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 -- .../Directory/DirectoryUpdateLog.cs | 18 -- .../Directory/EmployeeBucketMapping.cs | 19 -- .../Dtos/Directory/CreateBucketDto.cs | 8 - .../Dtos/Directory/CreateContactDto.cs | 15 -- .../Dtos/Directory/CreateContactEmailDto.cs | 9 - .../Dtos/Directory/CreateContactNoteDto.cs | 8 - .../Dtos/Directory/CreateContactPhoneDto.cs | 9 - .../Dtos/Directory/UpdateContactDto.cs | 16 -- .../Dtos/Directory/UpdateContactEmailDto.cs | 10 - .../Dtos/Directory/UpdateContactNoteDto.cs | 9 - .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 - .../Dtos/Master/CreateContactCategoryDto.cs | 8 - .../Dtos/Master/CreateContactTagDto.cs | 7 - .../Dtos/Master/UpdateContactCategoryDto.cs | 9 - .../Dtos/Master/UpdateContactTagDto.cs | 8 - Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ------------------ .../ViewModels/Directory/ContactEmailVM.cs | 10 - .../ViewModels/Directory/ContactPhoneVM.cs | 10 - .../ViewModels/Directory/ContactVM.cs | 18 -- .../ViewModels/Master/ContactCategoryVM.cs | 9 - .../ViewModels/Master/ContactTagVM.cs | 8 - 30 files changed, 556 deletions(-) delete mode 100644 Marco.Pms.Model/Directory/Bucket.cs delete mode 100644 Marco.Pms.Model/Directory/Contact.cs delete mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs delete mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs delete mode 100644 Marco.Pms.Model/Directory/ContactNote.cs delete mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs delete mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs delete mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs deleted file mode 100644 index 028b428..0000000 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class Bucket : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs deleted file mode 100644 index 87d7698..0000000 --- a/Marco.Pms.Model/Directory/Contact.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class Contact : TenantRelation - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - public string Organization { get; set; } = string.Empty; - public string? Address { get; set; } - public bool IsActive { get; set; } = true; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - - [DisplayName("ContactCategoryId")] - public Guid? ContactCategoryId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactCategoryId))] - public ContactCategoryMaster? ContactCategory { get; set; } - public DateTime CreatedAt { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs deleted file mode 100644 index 9444337..0000000 --- a/Marco.Pms.Model/Directory/ContactBucketMapping.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs deleted file mode 100644 index 8fb1a94..0000000 --- a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactCategoryMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs deleted file mode 100644 index 1eb1b34..0000000 --- a/Marco.Pms.Model/Directory/ContactEmail.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactEmail - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string EmailAddress { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs deleted file mode 100644 index e203f1d..0000000 --- a/Marco.Pms.Model/Directory/ContactNote.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactNote : TenantRelation - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? Createdby { get; set; } - public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - public Guid ContactId { get; set; } - - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs deleted file mode 100644 index d10439b..0000000 --- a/Marco.Pms.Model/Directory/ContactPhone.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactPhone - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string PhoneNumber { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs deleted file mode 100644 index a3d7e9e..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMapping - { - public Guid Id { get; set; } - public Guid ContactId { get; set; } - public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } - public ContactTagMaster? ContactTag { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs deleted file mode 100644 index 86eba76..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs deleted file mode 100644 index 91b1b7a..0000000 --- a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class DirectoryUpdateLog - { - public Guid Id { get; set; } - public Guid RefereanceId { get; set; } - public DateTime UpdateAt { get; set; } = DateTime.UtcNow; - public Guid UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs deleted file mode 100644 index db12d3f..0000000 --- a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class EmployeeBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid EmployeeId { get; set; } - [ValidateNever] - [ForeignKey("EmployeeId")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs deleted file mode 100644 index ba0918d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateBucketDto - { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs deleted file mode 100644 index 42937c0..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactDto - { - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs deleted file mode 100644 index 68bb2b2..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactEmailDto - { - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs deleted file mode 100644 index 1ccaea9..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactNoteDto - { - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs deleted file mode 100644 index dc97881..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactPhoneDto - { - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs deleted file mode 100644 index 042150d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactDto - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs deleted file mode 100644 index 8ece036..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactEmailDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs deleted file mode 100644 index 295357a..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactNoteDto - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs deleted file mode 100644 index 1ddfb14..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactPhoneDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs deleted file mode 100644 index 3efc443..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactCategoryDto - { - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs deleted file mode 100644 index ad91ca7..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactTagDto - { - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs deleted file mode 100644 index 0bd5cc7..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactCategoryDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs deleted file mode 100644 index 0406a6c..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactTagDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs deleted file mode 100644 index 048a0d2..0000000 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ /dev/null @@ -1,177 +0,0 @@ -using Marco.Pms.Model.Directory; -using Marco.Pms.Model.Dtos.Directory; -using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.ViewModels.Directory; -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.Mapper -{ - public static class DirectoryMapper - { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) - { - - return new Contact - { - ProjectId = createContactDto.ProjectId, - Name = createContactDto.Name ?? string.Empty, - ContactCategoryId = createContactDto.ContactCategoryId, - Description = createContactDto.Description ?? string.Empty, - Organization = createContactDto?.Organization ?? string.Empty, - Address = createContactDto != null ? createContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) - { - - return new Contact - { - Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, - Name = updateContactDto.Name ?? string.Empty, - ContactCategoryId = updateContactDto.ContactCategoryId, - Description = updateContactDto.Description ?? string.Empty, - Organization = updateContactDto?.Organization ?? string.Empty, - Address = updateContactDto != null ? updateContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static ContactVM ToContactVMFromContact(this Contact contact) - { - return new ContactVM - { - Id = contact.Id, - ProjectId = contact.ProjectId, - Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), - Description = contact.Description ?? string.Empty, - Organization = contact.Organization ?? string.Empty, - Address = contact.Address ?? string.Empty - }; - } - - //Contact Phone Mapper - public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Label = createContactPhoneDto.Label ?? string.Empty, - PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Id = updateContactPhoneDto.Id, - Label = updateContactPhoneDto.Label ?? string.Empty, - PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) - { - return new ContactPhoneVM - { - Id = phone.Id, - Label = phone.Label ?? string.Empty, - PhoneNumber = phone.PhoneNumber ?? string.Empty, - ContactId = phone.ContactId - }; - } - - //Contact Email Mapper - public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Label = createContactEmailDto.Label ?? string.Empty, - EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Id = updateContactEmailDto.Id, - Label = updateContactEmailDto.Label ?? string.Empty, - EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) - { - return new ContactEmailVM - { - Id = email.Id, - Label = email.Label ?? string.Empty, - EmailAddress = email.EmailAddress ?? string.Empty, - ContactId = email.ContactId - }; - } - - //Contact Tag Mapper - public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Name = createContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Id = updateContactTagDto.Id, - Name = updateContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) - { - return new ContactTagVM - { - Id = contactTag.Id, - Name = contactTag.Name ?? string.Empty, - }; - } - - //Contact Category Mapper - public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Name = createContactTypeDto.Name ?? string.Empty, - Description = createContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Id = updateContactTypeDto.Id, - Name = updateContactTypeDto.Name ?? string.Empty, - Description = updateContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) - { - return new ContactCategoryVM - { - Id = contactType.Id, - Name = contactType.Name ?? string.Empty, - Description = contactType.Description ?? string.Empty, - }; - } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs deleted file mode 100644 index 476e44d..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactEmailVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs deleted file mode 100644 index 1dc7672..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactPhoneVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs deleted file mode 100644 index 6d6f82e..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactVM - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? Tags { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs deleted file mode 100644 index eb08d89..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactCategoryVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs deleted file mode 100644 index 2cb6f8a..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactTagVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} -- 2.43.0 From 1092c3760927eb1409dd223e5fa4fa0c39f99695 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:27:36 +0530 Subject: [PATCH 003/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From 0d0e9c38b64cf3d947b08d915b9402cae299ae6e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:38:47 +0530 Subject: [PATCH 004/469] Added Directory controller file --- Marco.Pms.Services/Controllers/DirectoryController.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Marco.Pms.Services/Controllers/DirectoryController.cs diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs new file mode 100644 index 0000000..77a183c --- /dev/null +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Marco.Pms.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class DirectoryController : ControllerBase + { + } +} -- 2.43.0 From 261a75511e59bc7f575781a82e9b027d5bc9b73a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:44:30 +0530 Subject: [PATCH 005/469] An API skeleton has been added. --- .../Controllers/DirectoryController.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 77a183c..b0de798 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,4 +1,8 @@ -using Microsoft.AspNetCore.Mvc; +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Dtos.Directory; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { @@ -6,5 +10,32 @@ namespace Marco.Pms.Services.Controllers [ApiController] public class DirectoryController : ControllerBase { + + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + + [HttpGet] + public async Task GetContactList() + { + return Ok(); + } + + [HttpPost] + public async Task CreateContact([FromBody] CreateContactDto createContact) + { + return Ok(); + } + { + return Ok(); } } +} -- 2.43.0 From a960866c2102a618c02c320b6a71b724a0aed585 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 16:10:07 +0530 Subject: [PATCH 006/469] Added Migration for contact related tables --- .../Data/ApplicationDbContext.cs | 13 + ...Added_Directory_Related_Tables.Designer.cs | 2990 +++++++++++++++++ ...14103249_Added_Directory_Related_Tables.cs | 440 +++ .../ApplicationDbContextModelSnapshot.cs | 479 +++ Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- 5 files changed, 3923 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 817afd2..619771e 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -2,6 +2,7 @@ using Marco.Pms.Model.Activities; using Marco.Pms.Model.AttendanceModule; using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.DocumentManager; using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; @@ -89,6 +90,18 @@ namespace Marco.Pms.DataAccess.Data public DbSet Documents { get; set; } public DbSet TicketTags { get; set; } public DbSet WorkCategoryMasters { get; set; } + public DbSet Contacts { get; set; } + public DbSet ContactCategoryMasters { get; set; } + public DbSet ContactsEmails { get; set; } + public DbSet ContactsPhones { get; set; } + public DbSet ContactNotes { get; set; } + public DbSet Buckets { get; set; } + public DbSet ContactTagMasters { get; set; } + public DbSet ContactTagMappings { get; set; } + public DbSet EmployeeBucketMappings { get; set; } + public DbSet ContactBucketMappings { get; set; } + public DbSet DirectoryUpdateLogs { get; set; } + protected override void OnModelCreating(ModelBuilder modelBuilder) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs new file mode 100644 index 0000000..f50346e --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -0,0 +1,2990 @@ +// +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("20250514103249_Added_Directory_Related_Tables")] + partial class Added_Directory_Related_Tables + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs new file mode 100644 index 0000000..879f54b --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -0,0 +1,440 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_Directory_Related_Tables : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Buckets", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Buckets", x => x.Id); + table.ForeignKey( + name: "FK_Buckets_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactCategoryMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactCategoryMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactCategoryMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "DirectoryUpdateLogs", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + RefereanceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + UpdateAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_DirectoryUpdateLogs", x => x.Id); + table.ForeignKey( + name: "FK_DirectoryUpdateLogs_Employees_UpdatedById", + column: x => x.UpdatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "EmployeeBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_EmployeeBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Contacts", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: true, 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"), + Organization = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Address = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactCategoryId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Contacts", x => x.Id); + table.ForeignKey( + name: "FK_Contacts_ContactCategoryMasters_ContactCategoryId", + column: x => x.ContactCategoryId, + principalTable: "ContactCategoryMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Contacts_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contacts_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactBucketMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactNotes", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactNotes", x => x.Id); + table.ForeignKey( + name: "FK_ContactNotes_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsEmails", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmailAddress = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsEmails", x => x.Id); + table.ForeignKey( + name: "FK_ContactsEmails_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsPhones", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsPhones", x => x.Id); + table.ForeignKey( + name: "FK_ContactsPhones_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + column: x => x.ContactTagId, + principalTable: "ContactTagMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ContactTagMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_TenantId", + table: "Buckets", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_BucketId", + table: "ContactBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_ContactId", + table: "ContactBucketMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactCategoryMasters_TenantId", + table: "ContactCategoryMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_ContactId", + table: "ContactNotes", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_CreatedById", + table: "ContactNotes", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_TenantId", + table: "ContactNotes", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_ContactCategoryId", + table: "Contacts", + column: "ContactCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_CreatedById", + table: "Contacts", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_TenantId", + table: "Contacts", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsEmails_ContactId", + table: "ContactsEmails", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsPhones_ContactId", + table: "ContactsPhones", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactId", + table: "ContactTagMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMasters_TenantId", + table: "ContactTagMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DirectoryUpdateLogs_UpdatedById", + table: "DirectoryUpdateLogs", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_BucketId", + table: "EmployeeBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_EmployeeId", + table: "EmployeeBucketMappings", + column: "EmployeeId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactNotes"); + + migrationBuilder.DropTable( + name: "ContactsEmails"); + + migrationBuilder.DropTable( + name: "ContactsPhones"); + + migrationBuilder.DropTable( + name: "ContactTagMappings"); + + migrationBuilder.DropTable( + name: "DirectoryUpdateLogs"); + + migrationBuilder.DropTable( + name: "EmployeeBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactTagMasters"); + + migrationBuilder.DropTable( + name: "Contacts"); + + migrationBuilder.DropTable( + name: "Buckets"); + + migrationBuilder.DropTable( + name: "ContactCategoryMasters"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 5f0c3a8..83f0533 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -263,6 +263,312 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("RefreshTokens"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.Property("Id") @@ -2061,6 +2367,179 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("User"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 048a0d2..d66615a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty -- 2.43.0 From c8a18bbdba14e2b2a3a5c642f6a3b9679d5bb34d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 17:51:57 +0530 Subject: [PATCH 007/469] Added DirectoryHelper in helper folder --- .../Dtos/Directory/CreateContactDto.cs | 3 +- .../Dtos/Directory/UpdateContactDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 ++- .../Controllers/DirectoryController.cs | 34 ++++++++++++------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 21 ++++++++++++ Marco.Pms.Services/Program.cs | 2 ++ 6 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 Marco.Pms.Services/Helpers/DirectoryHelper.cs diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 42937c0..6e962a4 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -6,7 +6,8 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } + public List? BucketIds { get; set; } + public Guid? ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 042150d..7c93cce 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -7,6 +7,7 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } + public List? BucketIds { get; set; } public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index d66615a..abf72d3 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -8,7 +8,7 @@ namespace Marco.Pms.Model.Mapper { public static class DirectoryMapper { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId, Guid employeeId) { return new Contact @@ -19,6 +19,8 @@ namespace Marco.Pms.Model.Mapper Description = createContactDto.Description ?? string.Empty, Organization = createContactDto?.Organization ?? string.Empty, Address = createContactDto != null ? createContactDto.Address : string.Empty, + CreatedById = employeeId, + CreatedAt = DateTime.UtcNow, TenantId = tenantId }; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b0de798..a2f984c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,26 +1,25 @@ -using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Dtos.Directory; -using MarcoBMS.Services.Helpers; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { - [Route("api/[controller]")] [ApiController] + [Route("api/[controller]")] + public class DirectoryController : ControllerBase { - private readonly ApplicationDbContext _context; + private readonly DirectoryHelper _directoryHelper; private readonly ILoggingService _logger; - private readonly UserHelper _userHelper; - public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + public DirectoryController(DirectoryHelper directoryHelper, ILoggingService logger) { - _context = context; + _directoryHelper = directoryHelper; _logger = logger; - _userHelper = userHelper; } [HttpGet] @@ -32,10 +31,21 @@ namespace Marco.Pms.Services.Controllers [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + return Ok(); } - { - return Ok(); + + + + } } -} diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs new file mode 100644 index 0000000..832d190 --- /dev/null +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -0,0 +1,21 @@ +using Marco.Pms.DataAccess.Data; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; + +namespace Marco.Pms.Services.Helpers +{ + public class DirectoryHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index 1d69193..dbd6912 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -3,6 +3,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Authentication; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using Marco.Pms.Services.Service; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Middleware; @@ -130,6 +131,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From 289b086cb3360cd0113aaff487db9c10cfa0bf7a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 008/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 2 +- .../Dtos/Directory/CreateContactPhoneDto.cs | 1 - .../Controllers/DirectoryController.cs | 11 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 116 ++++++++++++++++++ .../appsettings.Development.json | 2 +- 5 files changed, 127 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 68bb2b2..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,6 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } } } + diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index dc97881..a72ac3d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,6 +4,5 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a2f984c..c913fdb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -40,8 +40,15 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("User sent Invalid Date while marking attendance"); return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); } - - return Ok(); + var response = await _directoryHelper.CreateContact(createContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 832d190..984043a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,6 +1,13 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; namespace Marco.Pms.Services.Helpers { @@ -17,5 +24,114 @@ namespace Marco.Pms.Services.Helpers _logger = logger; _userHelper = userHelper; } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json index 91af3c4..1522ad9 100644 --- a/Marco.Pms.Services/appsettings.Development.json +++ b/Marco.Pms.Services/appsettings.Development.json @@ -12,7 +12,7 @@ }, "ConnectionStrings": { //"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2" - "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS10" + "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSDev" }, "MongoDB": { "SerilogDatabaseUrl": "mongodb://localhost:27017/DotNetLogs" -- 2.43.0 From c52079c4db03b4924d03e0432ebe8d65baedc26d Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 009/469] created GetListOfContact custome function --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../ViewModels/Directory/ContactVM.cs | 2 +- .../Controllers/DirectoryController.cs | 13 ++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 92 ++++++++++++++++++- 4 files changed, 105 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index abf72d3..fbe0e46 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index 6d6f82e..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.ViewModels.Directory public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a2f984c..efa76c3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,7 +25,18 @@ namespace Marco.Pms.Services.Controllers [HttpGet] public async Task GetContactList() { - return Ok(); + var response = await _directoryHelper.GetListOfContacts(); + + + if(response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 832d190..5e11587 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,6 +1,12 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; namespace Marco.Pms.Services.Helpers { @@ -17,5 +23,89 @@ namespace Marco.Pms.Services.Helpers _logger = logger; _userHelper = userHelper; } + + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + + List contactIds = contacts.Select(c=>c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); + + var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); + + + List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if(emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if(phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + + if (tagMappingss != null) { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag.ToContactTagVMFromContactTagMaster(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + + return ApiResponse.SuccessResponse(list, "Contact List !",200); + + } } -} + } -- 2.43.0 From f6e4684ecb0e7f2ba2ff84a388a644fb3d6f1182 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 010/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 2 +- .../Dtos/Directory/CreateContactPhoneDto.cs | 1 - .../Controllers/DirectoryController.cs | 11 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 110 ++++++++++++++++++ .../appsettings.Development.json | 2 +- 5 files changed, 121 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 68bb2b2..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,6 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } } } + diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index dc97881..a72ac3d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,6 +4,5 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index efa76c3..afcb061 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -51,8 +51,15 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("User sent Invalid Date while marking attendance"); return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); } - - return Ok(); + var response = await _directoryHelper.CreateContact(createContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5e11587..b1f6e9c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,5 +1,6 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; @@ -107,5 +108,114 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, "Contact List !",200); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json index 91af3c4..1522ad9 100644 --- a/Marco.Pms.Services/appsettings.Development.json +++ b/Marco.Pms.Services/appsettings.Development.json @@ -12,7 +12,7 @@ }, "ConnectionStrings": { //"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2" - "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS10" + "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSDev" }, "MongoDB": { "SerilogDatabaseUrl": "mongodb://localhost:27017/DotNetLogs" -- 2.43.0 From 95129be836f0260645101af003a56cf1a2bb59c4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 011/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../Controllers/DirectoryController.cs | 6 ++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 39 ++++++++----------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index fbe0e46..b9e9f86 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index afcb061..b5ac7e5 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -2,12 +2,14 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { [ApiController] [Route("api/[controller]")] + [Authorize] public class DirectoryController : ControllerBase { @@ -28,7 +30,7 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetListOfContacts(); - if(response.StatusCode == 200) + if (response.StatusCode == 200) { return Ok(response); } @@ -36,7 +38,7 @@ namespace Marco.Pms.Services.Controllers { return BadRequest(response); } - + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b1f6e9c..c34d2ac 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -30,21 +30,17 @@ namespace Marco.Pms.Services.Helpers public async Task> GetListOfContacts() { Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - - List contactIds = contacts.Select(c=>c.Id).ToList(); + List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); + var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); - var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); - - var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); - - - List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); - - var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); + var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); List list = new List(); @@ -55,13 +51,13 @@ namespace Marco.Pms.Services.Helpers List contactEmailVms = new List(); List contactPhoneVms = new List(); - List conatctTagVms = new List(); + List conatctTagVms = new List(); var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - if(emails != null) + if (emails != null) { foreach (var email in emails) { @@ -70,8 +66,8 @@ namespace Marco.Pms.Services.Helpers contactEmailVms.Add(emailVM); } } - - if(phones != null) + + if (phones != null) { foreach (var phone in phones) { @@ -81,14 +77,14 @@ namespace Marco.Pms.Services.Helpers } } - - if (tagMappingss != null) { + if (tagMappingss != null) + { foreach (var tagMapping in tagMappingss) { ContactTagVM tagVM = new ContactTagVM(); ; var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); - tagVM = tag.ToContactTagVMFromContactTagMaster(); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); conatctTagVms.Add(tagVM); @@ -97,15 +93,14 @@ namespace Marco.Pms.Services.Helpers contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; - + list.Add(contactVM); } - - return ApiResponse.SuccessResponse(list, "Contact List !",200); + _logger.LogInfo("{count} contacts are fetched by Employee with ID {LoggedInEmployeeId}", list.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } @@ -218,4 +213,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From 7bd3b3816f9ae286053bae3e4a1d9d1729cdb9d8 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 12:51:23 +0530 Subject: [PATCH 012/469] Created an API to create the Contact category --- .../Dtos/Master/CreateContactTagDto.cs | 1 + .../Dtos/Master/UpdateContactTagDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Master/ContactTagVM.cs | 1 + .../Controllers/MasterController.cs | 81 ++++++++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 54 +++++++++++++ Marco.Pms.Services/Program.cs | 1 + 7 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Services/Helpers/MasterHelper.cs diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs index ad91ca7..2fec4ae 100644 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -3,5 +3,6 @@ public class CreateContactTagDto { public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs index 0406a6c..e97ece6 100644 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b9e9f86..82e703f 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -125,6 +125,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagMaster { Name = createContactTagDto.Name ?? string.Empty, + Description = createContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -134,6 +135,7 @@ namespace Marco.Pms.Model.Mapper { Id = updateContactTagDto.Id, Name = updateContactTagDto.Name ?? string.Empty, + Description = updateContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -142,6 +144,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagVM { Id = contactTag.Id, + Description = contactTag.Description ?? string.Empty, Name = contactTag.Name ?? string.Empty, }; } diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs index 2cb6f8a..321b669 100644 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index b89dc91..0d0221b 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -9,6 +9,7 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Activities; using Marco.Pms.Model.ViewModels.Forum; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Authorization; @@ -25,11 +26,13 @@ namespace Marco.Pms.Services.Controllers private readonly ApplicationDbContext _context; private readonly UserHelper _userHelper; private readonly ILoggingService _logger; - public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger) + private readonly MasterHelper _masterHelper; + public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger, MasterHelper masterHelper) { _context = context; _userHelper = userHelper; _logger = logger; + _masterHelper = masterHelper; } // -------------------------------- Activity -------------------------------- @@ -667,5 +670,81 @@ namespace Marco.Pms.Services.Controllers return NotFound(ApiResponse.ErrorResponse("Work category not found", "Work category not found", 404)); } } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-categories")] + public async Task GetContactCategoryMasterList() + { + return Ok(); + } + + [HttpGet("contact-category/{id})")] + public async Task GetContactCategoryMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-category")] + public async Task CreateContactCategoryMaster([FromBody] CreateContactCategoryDto contactCategoryDto) + { + var response = await _masterHelper.CreateContactCategory(contactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPost("contact-category/edit/{id}")] + public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) + { + return Ok(); + } + + [HttpDelete("contact-category/{id}")] + public async Task DeletecontactCategoryMaster(Guid id) + { + return Ok(); + } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-tags")] + public async Task GetContactTagMasterList() + { + return Ok(); + } + + [HttpGet("contact-tag/{id})")] + public async Task GetContactTagMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-tag")] + public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) + { + return Ok(); + } + + [HttpPost("contact-tag/edit/{id}")] + public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) + { + return Ok(); + } + + [HttpDelete("contact-tag/{id}")] + public async Task DeletecontactTagMaster(Guid id) + { + return Ok(); + } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs new file mode 100644 index 0000000..893eee2 --- /dev/null +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -0,0 +1,54 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Master; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; + +namespace Marco.Pms.Services.Helpers +{ + public class MasterHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public MasterHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + // -------------------------------- Contact Category -------------------------------- + public async Task> CreateContactCategory(CreateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactCategoryDto.Name != null ? contactCategoryDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactCategoryMaster contactCategory = contactCategoryDto.ToContactCategoryMasterFromCreateContactCategoryDto(tenantId); + _context.ContactCategoryMasters.Add(contactCategory); + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact category.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category already existed", "Category already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + // -------------------------------- Contact Tag -------------------------------- + // -------------------------------- Bucket -------------------------------- + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index dbd6912..4cb3abf 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -132,6 +132,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From e61289ed1b6e30f5e51b19f104216265fb757812 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 013/469] Created an endpoint to fetch list of all contact category in that tenant --- .../Controllers/MasterController.cs | 5 +++-- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 0d0221b..fe0f1e9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -676,7 +676,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-categories")] public async Task GetContactCategoryMasterList() { - return Ok(); + var response = await _masterHelper.GetContactCategoriesList(); + return Ok(response); } [HttpGet("contact-category/{id})")] @@ -715,7 +716,7 @@ namespace Marco.Pms.Services.Controllers return Ok(); } - // -------------------------------- Contact Category -------------------------------- + // -------------------------------- Contact Tag -------------------------------- [HttpGet("contact-tags")] public async Task GetContactTagMasterList() diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 893eee2..75c6d5f 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -48,6 +48,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- // -------------------------------- Bucket -------------------------------- } -- 2.43.0 From b6a5e4562f44151366c815f878d63e673bdf8457 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 014/469] Added an API to update existing contact --- .../Dtos/Directory/ContactTagDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactEmailDto.cs | 2 +- .../Dtos/Directory/UpdateContactPhoneDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +- .../Controllers/DirectoryController.cs | 18 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 8 files changed, 258 insertions(+), 13 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs new file mode 100644 index 0000000..12b0223 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactTagDto + { + public Guid? Id { get; set; } + public string Name { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 6e962a4..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -11,6 +11,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 7c93cce..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -12,6 +12,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs index 8ece036..186f5b3 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactEmailDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? EmailAddress { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs index 1ddfb14..ff0ec23 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactPhoneDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? PhoneNumber { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 82e703f..9b5c835 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -68,7 +68,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactPhone { - Id = updateContactPhoneDto.Id, + Id = updateContactPhoneDto.Id ?? Guid.Empty, Label = updateContactPhoneDto.Label ?? string.Empty, PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, ContactId = contactId, @@ -101,7 +101,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactEmail { - Id = updateContactEmailDto.Id, + Id = updateContactEmailDto.Id ?? Guid.Empty, Label = updateContactEmailDto.Label ?? string.Empty, EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, ContactId = contactId, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b5ac7e5..fe82bce 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -64,7 +64,23 @@ namespace Marco.Pms.Services.Controllers } } - + [HttpPut("{id}")] + public async Task UpdateContact(Guid id, [FromBody] UpdateContactDto updateContact) + { + var response = await _directoryHelper.UpdateContact(id, updateContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c34d2ac..81f419c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -162,17 +162,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -209,8 +224,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From 94f3fad09f9e72689e342e6f159d52f665891f59 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 015/469] added api to get list of contact tag --- .../Controllers/MasterController.cs | 3 ++- Marco.Pms.Services/Helpers/MasterHelper.cs | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index fe0f1e9..4df3a62 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -721,7 +721,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-tags")] public async Task GetContactTagMasterList() { - return Ok(); + var response = await _masterHelper.GetContactTags(); + return Ok(response); } [HttpGet("contact-tag/{id})")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 75c6d5f..ca1bbde 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -65,6 +66,23 @@ namespace Marco.Pms.Services.Helpers } // -------------------------------- Contact Tag -------------------------------- + + + public async Task> GetContactTags() + { + Guid tenantId = _userHelper.GetTenantId(); + + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + List contactTags = new List(); + foreach (var tag in taglist) { + ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); + contactTags.Add(tagVm); + } + _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + } // -------------------------------- Bucket -------------------------------- } } -- 2.43.0 From 2429e2056629a401dcd9cb973572022583cf5f39 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 016/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 11 ++++++++++ .../ViewModels/Directory/BucketVM.cs | 9 ++++++++ .../Controllers/DirectoryController.cs | 6 +++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/BucketVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 9b5c835..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -178,5 +178,16 @@ namespace Marco.Pms.Model.Mapper Description = contactType.Description ?? string.Empty, }; } + + // Bucket + public static BucketVM ToBucketVMFromBucket(this Bucket bucket) + { + return new BucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs new file mode 100644 index 0000000..ce9ed9e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class BucketVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fe82bce..65ccd2d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -83,5 +83,11 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("buckets")] + public async Task GetBucketList() + { + var response = await _directoryHelper.GetBucketList(); + return Ok(response); + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 81f419c..5d8e0b7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -433,5 +433,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From 103bdcfb0b62b2456cc28222a2e9d31aebd29aa2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 017/469] Added an API to create a contact tag --- .../Controllers/MasterController.cs | 23 ++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 34 ++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 4df3a62..8e4a86f 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -734,7 +734,28 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag")] public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) { - return Ok(); + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _masterHelper.CreateContactTag(contactTagDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-tag/edit/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ca1bbde..1906ec2 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -76,13 +75,38 @@ namespace Marco.Pms.Services.Helpers var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); List contactTags = new List(); - foreach (var tag in taglist) { + foreach (var tag in taglist) + { ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); contactTags.Add(tagVm); } _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count), 200); } - // -------------------------------- Bucket -------------------------------- + public async Task> CreateContactTag(CreateContactTagDto contactTagDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); + _context.ContactTagMasters.Add(contactTag); + await _context.SaveChangesAsync(); + ContactTagVM tagVM = contactTag.ToContactTagVMFromContactTagMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact tag {ContactTagId}.", LoggedInEmployee.Id, contactTag.Id); + return ApiResponse.SuccessResponse(tagVM, "Tag Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact tag.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Tag already existed", "Tag already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + } } -- 2.43.0 From 455f51f4bd46f32a379a1dc3cda6d96bac0acf8b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:38:24 +0530 Subject: [PATCH 018/469] Fixed the errorof finding tag in wrong table --- Marco.Pms.Services/Helpers/MasterHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 1906ec2..66d3b45 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -89,8 +89,8 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (contactTagDto != null) { - ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); - if (existingContactCategory == null) + ContactTagMaster? existingContactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactTag == null) { ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); _context.ContactTagMasters.Add(contactTag); -- 2.43.0 From da552afb0d245071f75e0ebfb56bd840088db0f1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 019/469] Added an API to create bucket --- .../Dtos/Directory/CreateBucketDto.cs | 4 +- .../Controllers/DirectoryController.cs | 28 ++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs index ba0918d..0c02457 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -2,7 +2,7 @@ { public class CreateBucketDto { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 65ccd2d..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -89,5 +89,33 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetBucketList(); return Ok(response); } + + [HttpPost("bucket")] + public async Task CreateBucket(CreateBucketDto bucketDto) + { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _directoryHelper.CreateBucket(bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5d8e0b7..704a0d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -455,5 +455,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From 6a456001fd0136a0b8557754cf61e9dc206a5fd8 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 020/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 704a0d0..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -377,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 22f777ca87053d2c79db610a27b8d7a5169e57bc Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 021/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3415 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 619771e..b99c5bb 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -100,6 +100,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 83f0533..dc36e72 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2482,6 +2505,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..46d0482 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..aa1ef35 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,6 +41,24 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 801e0e18058b90d4832c66494f74c7b555cf1706 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 022/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 23 insertions(+), 3415 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index b99c5bb..619771e 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -100,7 +100,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index dc36e72..83f0533 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,6 +320,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -475,32 +478,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2505,33 +2482,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -42,6 +44,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index aa1ef35..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,24 +41,6 @@ namespace Marco.Pms.Services.Controllers } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,19 +31,13 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - - List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -61,10 +55,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -74,7 +67,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -84,7 +77,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -97,17 +90,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -119,102 +104,6 @@ namespace Marco.Pms.Services.Helpers } - public async Task> GetContactsListByBucketId(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); - if (employeeBucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); - } - List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); - List contactVMs = new List(); - if (contactBucket.Count > 0) - { - var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); - List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); - List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); - - List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); - List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - - List tagIds = new List(); - List tagMasters = new List(); - if (tags.Count > 0) - { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); - tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - } - - if (contacts.Count > 0) - { - - - foreach (var contact in contacts) - { - List? emailVMs = new List(); - List? phoneVMs = new List(); - List? tagVMs = new List(); - - List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); - List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); - - List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); - List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); - List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); - - if (contactPhones.Count > 0) - { - foreach (var phone in contactPhones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - } - if (contactEmails.Count > 0) - { - foreach (var email in contactEmails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - } - if (contactTags.Count > 0) - { - foreach (var contactTag in contactTags) - { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); - if (tagMaster != null) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - } - } - ContactVM contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = emailVMs; - contactVM.ContactPhones = phoneVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - contactVMs.Add(contactVM); - } - } - - } - _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -234,8 +123,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -258,7 +145,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -274,29 +160,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -314,8 +179,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -326,20 +190,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -365,8 +221,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -385,7 +239,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -405,9 +259,6 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -495,33 +346,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } - if (updateContact.ProjectIds != null) - { - foreach (var ProjectId in updateContact.ProjectIds) - { - if (!projectIds.Contains(ProjectId)) - { - _context.ContactProjectMappings.Add(new ContactProjectMapping - { - ProjectId = ProjectId, - ContactId = contact.Id - }); - } - } - - foreach (var projectMapping in contactProjects) - { - if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) - { - _context.ContactProjectMappings.Remove(projectMapping); - } - } - } - else if (contactProjects != null) - { - _context.ContactProjectMappings.RemoveRange(contactProjects); - } - if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -540,8 +364,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -554,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -576,10 +399,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -608,9 +427,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 9f543d18599ee3c1cf2034e45c7380e55e7cdf27 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 023/469] Added an API to delete existing contact category --- .../Controllers/MasterController.cs | 3 +- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 8e4a86f..e782913 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -713,7 +713,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-category/{id}")] public async Task DeletecontactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactCategory(id); + return Ok(response); } // -------------------------------- Contact Tag -------------------------------- diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 66d3b45..33fab6b 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -63,6 +63,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 823da8d2cb555208c729b1ac4c76bd3c741b5890 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 024/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...63809_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 17 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3414 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 619771e..dd6a33e 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -101,6 +101,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } + public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..18a4be6 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517063809_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 83f0533..dc36e72 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2482,6 +2505,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..bd49e18 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -40,6 +40,23 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From f836f0dfb8f6375002cac84dca955dc3336529bc Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:28:54 +0530 Subject: [PATCH 025/469] Refetched the contact in update contact API --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..ff3f730 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -393,6 +393,7 @@ namespace Marco.Pms.Services.Helpers } var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + _context.Contacts.Update(newContact); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -573,6 +574,7 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 895f22c62a85a90cc2059cd1fe9d481adb680d56 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 026/469] properly mapped the updated Dto to contact table --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..f78c260 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -23,7 +23,7 @@ namespace Marco.Pms.Model.Mapper TenantId = tenantId }; } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId, Contact contact) { return new Contact @@ -31,6 +31,8 @@ namespace Marco.Pms.Model.Mapper Id = updateContactDto.Id, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, + CreatedAt = contact.CreatedAt, + CreatedById = contact.CreatedById, Description = updateContactDto.Description ?? string.Empty, Organization = updateContactDto?.Organization ?? string.Empty, Address = updateContactDto != null ? updateContactDto.Address : string.Empty, diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ff3f730..f1100c6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -385,15 +385,16 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.AsNoTracking().FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); + await _context.SaveChangesAsync(); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -505,7 +506,8 @@ namespace Marco.Pms.Services.Helpers _context.ContactProjectMappings.Add(new ContactProjectMapping { ProjectId = ProjectId, - ContactId = contact.Id + ContactId = contact.Id, + TenantId = tenantId }); } } @@ -572,7 +574,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 130574205588225d7a147acec59ce472f24f2b26 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 027/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f1100c6..d866509 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -36,7 +36,7 @@ namespace Marco.Pms.Services.Helpers List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); @@ -118,7 +118,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -233,6 +232,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); @@ -301,14 +301,14 @@ namespace Marco.Pms.Services.Helpers { foreach (var tag in createContact.Tags) { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) + if (tagNames.Contains(tag.Name.ToLower())) { - ContactTagMapping tagMapping = new ContactTagMapping + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); + _context.ContactTagMappings.Add(new ContactTagMapping { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); + ContactId = contact.Id, + ContactTagtId = tag.Id ?? existingTag.Id + }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) { @@ -373,7 +373,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -407,10 +406,12 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -530,12 +531,13 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + if (tagNames.Contains(tag.Name.ToLower())) { + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id.Value + ContactTagtId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -574,19 +576,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From cbddc5c9ce1f951fc7ea3fa0f9d36eade8cfb6fc Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 14:33:14 +0530 Subject: [PATCH 028/469] Added an API to deleted ContactTag as well remove entries in contact-tag mapping table related to that tag --- .../Controllers/MasterController.cs | 7 ++--- Marco.Pms.Services/Helpers/MasterHelper.cs | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index e782913..1ba1ee9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -680,7 +680,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-category/{id})")] + [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { return Ok(); @@ -726,7 +726,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-tag/{id})")] + [HttpGet("contact-tag/{id}")] public async Task GetContactTagMaster(Guid id) { return Ok(); @@ -768,7 +768,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-tag/{id}")] public async Task DeletecontactTagMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactTag(id); + return Ok(response); } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 33fab6b..ac05b97 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -139,7 +139,33 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactTag(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactTag != null) + { + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + _context.ContactTagMasters.Remove(contactTag); + if (tagMappings.Any()) + { + _context.ContactTagMappings.RemoveRange(tagMappings); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact tag {ContactTagId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Tag {ContactTagId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Tag deleted successfully", 200); + } } } -- 2.43.0 From b0758a58aed40f74d93824203a4b9cdadea53c68 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:13:35 +0530 Subject: [PATCH 029/469] added an API to get a list of contact-notes by contact ID --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 22 ++++++ .../ViewModels/Directory/ContactNoteVM.cs | 9 +++ .../Controllers/DirectoryController.cs | 67 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 +++++++ 4 files changed, 121 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index f78c260..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -188,5 +188,27 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + + //Contact Note + public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) + { + return new ContactNote + { + Note = noteDto.Note, + ContactId = noteDto.ContactId, + CreatedAt = DateTime.UtcNow, + CreatedById = employeeId, + TenantId = tenantId + }; + } + public static ContactNoteVM ToContactNoteVMFromContactNote(this ContactNote note) + { + return new ContactNoteVM + { + Id = note.Id, + Note = note.Note, + ContactId = note.ContactId + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs new file mode 100644 index 0000000..5e1c340 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactNoteVM + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index bd49e18..dd3785e 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,73 @@ namespace Marco.Pms.Services.Controllers } } + // -------------------------------- Contact Notes -------------------------------- + + [HttpPost("note")] + public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.CreateContactNote(noteDto); + //if (response.StatusCode == 200) + //{ + //return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpGet("note/{ContactId}")] + public async Task GetNoteListByContactId(Guid contactId) + { + var response = await _directoryHelper.GetNoteListByContactId(contactId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPut("note/{id}")] + public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.UpdateContactNote(id, noteDto); + //if (response.StatusCode == 200) + //{ + // return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpDelete("note/{id}")] + public async Task DeleteContactNote(Guid id) + { + return Ok(); + //var response = await _directoryHelper.DeleteContactNote(id); + //return Ok(response); + } + + // -------------------------------- Bucket -------------------------------- [HttpGet("buckets")] public async Task GetBucketList() diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d866509..b68a854 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -624,6 +624,29 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + // -------------------------------- Contact Notes -------------------------------- + + public async Task> GetNoteListByContactId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + noteVMs.Add(noteVM); + } + _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 37f0606bb079b393a9210f3d6d7ad5cec4f47e99 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 030/469] Added an API to get contact category by its size --- .../Controllers/MasterController.cs | 14 +++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 1ba1ee9..61baaa3 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -683,7 +683,19 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.GetContactCategoryById(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-category")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ac05b97..11015c8 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -47,7 +47,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -63,6 +62,22 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> GetContactCategoryById(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var category = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (category != null) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + _logger.LogInfo("Employee {EmployeeId} fetched contact category {ContactCategoryID}", LoggedInEmployee.Id, category.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category fetched successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} attempted to fetch contact category {ContactCategoryID} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } public async Task> DeleteContactCategory(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 948457a83f221f100be54ae7214e91a548151cb8 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 031/469] Added an API to Update existing Contact-note --- .../Controllers/DirectoryController.cs | 60 +++++++++---------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 ++++++++++++ 2 files changed, 67 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index dd3785e..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -104,20 +104,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("note")] public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.CreateContactNote(noteDto); - //if (response.StatusCode == 200) - //{ - //return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + + var response = await _directoryHelper.CreateContactNote(noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpGet("note/{ContactId}")] @@ -141,28 +141,26 @@ namespace Marco.Pms.Services.Controllers [HttpPut("note/{id}")] public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.UpdateContactNote(id, noteDto); - //if (response.StatusCode == 200) - //{ - // return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + var response = await _directoryHelper.UpdateContactNote(id, noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("note/{id}")] public async Task DeleteContactNote(Guid id) { - return Ok(); - //var response = await _directoryHelper.DeleteContactNote(id); - //return Ok(response); + var response = await _directoryHelper.DeleteContactNote(id); + return Ok(response); } // -------------------------------- Bucket -------------------------------- diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b68a854..a185a1d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -647,6 +647,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 651785720f27e70b31579bf2f9a1b5c351793a36 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 032/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a185a1d..9861a15 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -684,6 +684,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 077af5ac598e95751ca2d590ad8731ca7f151ea7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:43 +0530 Subject: [PATCH 033/469] Added an API to add a note to specific contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9861a15..ebaeb4e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -646,7 +646,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - + public async Task> CreateContactNote(CreateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote note = noteDto.ToContactNoteFromCreateContactNoteDto(tenantId, LoggedInEmployee.Id); + _context.ContactNotes.Add(note); + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + _logger.LogInfo("Employee {EmployeeId} Added note at contact {ContactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note added successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to add a note to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From a4b1a25cedb16a7759cb54a07091c495aa0d334b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 034/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From c5ef5e5d7c7cbbe9ecc7c3f94d00547ea088c6fe Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 09:51:01 +0000 Subject: [PATCH 035/469] revert c7e89630eb494454c1322bdf4cf29ab076af7b86 revert Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 -- Marco.Pms.Model/Directory/Contact.cs | 31 --- .../Directory/ContactBucketMapping.cs | 18 -- .../Directory/ContactCategoryMaster.cs | 11 -- Marco.Pms.Model/Directory/ContactEmail.cs | 21 --- Marco.Pms.Model/Directory/ContactNote.cs | 25 --- Marco.Pms.Model/Directory/ContactPhone.cs | 22 --- .../Directory/ContactTagMapping.cs | 11 -- Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 -- .../Directory/DirectoryUpdateLog.cs | 18 -- .../Directory/EmployeeBucketMapping.cs | 19 -- .../Dtos/Directory/CreateBucketDto.cs | 8 - .../Dtos/Directory/CreateContactDto.cs | 15 -- .../Dtos/Directory/CreateContactEmailDto.cs | 9 - .../Dtos/Directory/CreateContactNoteDto.cs | 8 - .../Dtos/Directory/CreateContactPhoneDto.cs | 9 - .../Dtos/Directory/UpdateContactDto.cs | 16 -- .../Dtos/Directory/UpdateContactEmailDto.cs | 10 - .../Dtos/Directory/UpdateContactNoteDto.cs | 9 - .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 - .../Dtos/Master/CreateContactCategoryDto.cs | 8 - .../Dtos/Master/CreateContactTagDto.cs | 7 - .../Dtos/Master/UpdateContactCategoryDto.cs | 9 - .../Dtos/Master/UpdateContactTagDto.cs | 8 - Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ------------------ .../ViewModels/Directory/ContactEmailVM.cs | 10 - .../ViewModels/Directory/ContactPhoneVM.cs | 10 - .../ViewModels/Directory/ContactVM.cs | 18 -- .../ViewModels/Master/ContactCategoryVM.cs | 9 - .../ViewModels/Master/ContactTagVM.cs | 8 - 30 files changed, 556 deletions(-) delete mode 100644 Marco.Pms.Model/Directory/Bucket.cs delete mode 100644 Marco.Pms.Model/Directory/Contact.cs delete mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs delete mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs delete mode 100644 Marco.Pms.Model/Directory/ContactNote.cs delete mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs delete mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs delete mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs deleted file mode 100644 index 028b428..0000000 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class Bucket : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs deleted file mode 100644 index 87d7698..0000000 --- a/Marco.Pms.Model/Directory/Contact.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class Contact : TenantRelation - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - public string Organization { get; set; } = string.Empty; - public string? Address { get; set; } - public bool IsActive { get; set; } = true; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - - [DisplayName("ContactCategoryId")] - public Guid? ContactCategoryId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactCategoryId))] - public ContactCategoryMaster? ContactCategory { get; set; } - public DateTime CreatedAt { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs deleted file mode 100644 index 9444337..0000000 --- a/Marco.Pms.Model/Directory/ContactBucketMapping.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs deleted file mode 100644 index 8fb1a94..0000000 --- a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactCategoryMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs deleted file mode 100644 index 1eb1b34..0000000 --- a/Marco.Pms.Model/Directory/ContactEmail.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactEmail - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string EmailAddress { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs deleted file mode 100644 index e203f1d..0000000 --- a/Marco.Pms.Model/Directory/ContactNote.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactNote : TenantRelation - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? Createdby { get; set; } - public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - public Guid ContactId { get; set; } - - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs deleted file mode 100644 index d10439b..0000000 --- a/Marco.Pms.Model/Directory/ContactPhone.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactPhone - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string PhoneNumber { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs deleted file mode 100644 index a3d7e9e..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMapping - { - public Guid Id { get; set; } - public Guid ContactId { get; set; } - public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } - public ContactTagMaster? ContactTag { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs deleted file mode 100644 index 86eba76..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs deleted file mode 100644 index 91b1b7a..0000000 --- a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class DirectoryUpdateLog - { - public Guid Id { get; set; } - public Guid RefereanceId { get; set; } - public DateTime UpdateAt { get; set; } = DateTime.UtcNow; - public Guid UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs deleted file mode 100644 index db12d3f..0000000 --- a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class EmployeeBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid EmployeeId { get; set; } - [ValidateNever] - [ForeignKey("EmployeeId")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs deleted file mode 100644 index ba0918d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateBucketDto - { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs deleted file mode 100644 index 42937c0..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactDto - { - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs deleted file mode 100644 index 68bb2b2..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactEmailDto - { - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs deleted file mode 100644 index 1ccaea9..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactNoteDto - { - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs deleted file mode 100644 index dc97881..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactPhoneDto - { - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs deleted file mode 100644 index 042150d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactDto - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs deleted file mode 100644 index 8ece036..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactEmailDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs deleted file mode 100644 index 295357a..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactNoteDto - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs deleted file mode 100644 index 1ddfb14..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactPhoneDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs deleted file mode 100644 index 3efc443..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactCategoryDto - { - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs deleted file mode 100644 index ad91ca7..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactTagDto - { - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs deleted file mode 100644 index 0bd5cc7..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactCategoryDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs deleted file mode 100644 index 0406a6c..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactTagDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs deleted file mode 100644 index 048a0d2..0000000 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ /dev/null @@ -1,177 +0,0 @@ -using Marco.Pms.Model.Directory; -using Marco.Pms.Model.Dtos.Directory; -using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.ViewModels.Directory; -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.Mapper -{ - public static class DirectoryMapper - { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) - { - - return new Contact - { - ProjectId = createContactDto.ProjectId, - Name = createContactDto.Name ?? string.Empty, - ContactCategoryId = createContactDto.ContactCategoryId, - Description = createContactDto.Description ?? string.Empty, - Organization = createContactDto?.Organization ?? string.Empty, - Address = createContactDto != null ? createContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) - { - - return new Contact - { - Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, - Name = updateContactDto.Name ?? string.Empty, - ContactCategoryId = updateContactDto.ContactCategoryId, - Description = updateContactDto.Description ?? string.Empty, - Organization = updateContactDto?.Organization ?? string.Empty, - Address = updateContactDto != null ? updateContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static ContactVM ToContactVMFromContact(this Contact contact) - { - return new ContactVM - { - Id = contact.Id, - ProjectId = contact.ProjectId, - Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), - Description = contact.Description ?? string.Empty, - Organization = contact.Organization ?? string.Empty, - Address = contact.Address ?? string.Empty - }; - } - - //Contact Phone Mapper - public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Label = createContactPhoneDto.Label ?? string.Empty, - PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Id = updateContactPhoneDto.Id, - Label = updateContactPhoneDto.Label ?? string.Empty, - PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) - { - return new ContactPhoneVM - { - Id = phone.Id, - Label = phone.Label ?? string.Empty, - PhoneNumber = phone.PhoneNumber ?? string.Empty, - ContactId = phone.ContactId - }; - } - - //Contact Email Mapper - public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Label = createContactEmailDto.Label ?? string.Empty, - EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Id = updateContactEmailDto.Id, - Label = updateContactEmailDto.Label ?? string.Empty, - EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) - { - return new ContactEmailVM - { - Id = email.Id, - Label = email.Label ?? string.Empty, - EmailAddress = email.EmailAddress ?? string.Empty, - ContactId = email.ContactId - }; - } - - //Contact Tag Mapper - public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Name = createContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Id = updateContactTagDto.Id, - Name = updateContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) - { - return new ContactTagVM - { - Id = contactTag.Id, - Name = contactTag.Name ?? string.Empty, - }; - } - - //Contact Category Mapper - public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Name = createContactTypeDto.Name ?? string.Empty, - Description = createContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Id = updateContactTypeDto.Id, - Name = updateContactTypeDto.Name ?? string.Empty, - Description = updateContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) - { - return new ContactCategoryVM - { - Id = contactType.Id, - Name = contactType.Name ?? string.Empty, - Description = contactType.Description ?? string.Empty, - }; - } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs deleted file mode 100644 index 476e44d..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactEmailVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs deleted file mode 100644 index 1dc7672..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactPhoneVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs deleted file mode 100644 index 6d6f82e..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactVM - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? Tags { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs deleted file mode 100644 index eb08d89..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactCategoryVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs deleted file mode 100644 index 2cb6f8a..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactTagVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} -- 2.43.0 From d4d1a132285175d7d6bd8ec7b03cd0f40195735b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:27:36 +0530 Subject: [PATCH 036/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From 109c8bbb81066c954d9fccb3525f6f1f9ba20518 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:38:47 +0530 Subject: [PATCH 037/469] Added Directory controller file --- Marco.Pms.Services/Controllers/DirectoryController.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Marco.Pms.Services/Controllers/DirectoryController.cs diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs new file mode 100644 index 0000000..77a183c --- /dev/null +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Marco.Pms.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class DirectoryController : ControllerBase + { + } +} -- 2.43.0 From c2c486a11d45856828b1f023a163b4adfba77812 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:44:30 +0530 Subject: [PATCH 038/469] An API skeleton has been added. --- .../Controllers/DirectoryController.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 77a183c..b0de798 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,4 +1,8 @@ -using Microsoft.AspNetCore.Mvc; +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Dtos.Directory; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { @@ -6,5 +10,32 @@ namespace Marco.Pms.Services.Controllers [ApiController] public class DirectoryController : ControllerBase { + + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + + [HttpGet] + public async Task GetContactList() + { + return Ok(); + } + + [HttpPost] + public async Task CreateContact([FromBody] CreateContactDto createContact) + { + return Ok(); + } + { + return Ok(); } } +} -- 2.43.0 From 7c37007a076999c85a41b074db7286b15f4b82ee Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 16:10:07 +0530 Subject: [PATCH 039/469] Added Migration for contact related tables --- .../Data/ApplicationDbContext.cs | 13 + ...Added_Directory_Related_Tables.Designer.cs | 2990 +++++++++++++++++ ...14103249_Added_Directory_Related_Tables.cs | 440 +++ .../ApplicationDbContextModelSnapshot.cs | 479 +++ Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- 5 files changed, 3923 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index db9492d..54fd3c3 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -2,6 +2,7 @@ using Marco.Pms.Model.Activities; using Marco.Pms.Model.AttendanceModule; using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.DocumentManager; using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; @@ -89,6 +90,18 @@ namespace Marco.Pms.DataAccess.Data public DbSet Documents { get; set; } public DbSet TicketTags { get; set; } public DbSet WorkCategoryMasters { get; set; } + public DbSet Contacts { get; set; } + public DbSet ContactCategoryMasters { get; set; } + public DbSet ContactsEmails { get; set; } + public DbSet ContactsPhones { get; set; } + public DbSet ContactNotes { get; set; } + public DbSet Buckets { get; set; } + public DbSet ContactTagMasters { get; set; } + public DbSet ContactTagMappings { get; set; } + public DbSet EmployeeBucketMappings { get; set; } + public DbSet ContactBucketMappings { get; set; } + public DbSet DirectoryUpdateLogs { get; set; } + protected override void OnModelCreating(ModelBuilder modelBuilder) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs new file mode 100644 index 0000000..f50346e --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -0,0 +1,2990 @@ +// +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("20250514103249_Added_Directory_Related_Tables")] + partial class Added_Directory_Related_Tables + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs new file mode 100644 index 0000000..879f54b --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -0,0 +1,440 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_Directory_Related_Tables : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Buckets", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Buckets", x => x.Id); + table.ForeignKey( + name: "FK_Buckets_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactCategoryMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactCategoryMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactCategoryMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "DirectoryUpdateLogs", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + RefereanceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + UpdateAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_DirectoryUpdateLogs", x => x.Id); + table.ForeignKey( + name: "FK_DirectoryUpdateLogs_Employees_UpdatedById", + column: x => x.UpdatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "EmployeeBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_EmployeeBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Contacts", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: true, 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"), + Organization = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Address = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactCategoryId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Contacts", x => x.Id); + table.ForeignKey( + name: "FK_Contacts_ContactCategoryMasters_ContactCategoryId", + column: x => x.ContactCategoryId, + principalTable: "ContactCategoryMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Contacts_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contacts_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactBucketMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactNotes", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactNotes", x => x.Id); + table.ForeignKey( + name: "FK_ContactNotes_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsEmails", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmailAddress = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsEmails", x => x.Id); + table.ForeignKey( + name: "FK_ContactsEmails_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsPhones", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsPhones", x => x.Id); + table.ForeignKey( + name: "FK_ContactsPhones_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + column: x => x.ContactTagId, + principalTable: "ContactTagMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ContactTagMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_TenantId", + table: "Buckets", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_BucketId", + table: "ContactBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_ContactId", + table: "ContactBucketMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactCategoryMasters_TenantId", + table: "ContactCategoryMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_ContactId", + table: "ContactNotes", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_CreatedById", + table: "ContactNotes", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_TenantId", + table: "ContactNotes", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_ContactCategoryId", + table: "Contacts", + column: "ContactCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_CreatedById", + table: "Contacts", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_TenantId", + table: "Contacts", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsEmails_ContactId", + table: "ContactsEmails", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsPhones_ContactId", + table: "ContactsPhones", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactId", + table: "ContactTagMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMasters_TenantId", + table: "ContactTagMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DirectoryUpdateLogs_UpdatedById", + table: "DirectoryUpdateLogs", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_BucketId", + table: "EmployeeBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_EmployeeId", + table: "EmployeeBucketMappings", + column: "EmployeeId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactNotes"); + + migrationBuilder.DropTable( + name: "ContactsEmails"); + + migrationBuilder.DropTable( + name: "ContactsPhones"); + + migrationBuilder.DropTable( + name: "ContactTagMappings"); + + migrationBuilder.DropTable( + name: "DirectoryUpdateLogs"); + + migrationBuilder.DropTable( + name: "EmployeeBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactTagMasters"); + + migrationBuilder.DropTable( + name: "Contacts"); + + migrationBuilder.DropTable( + name: "Buckets"); + + migrationBuilder.DropTable( + name: "ContactCategoryMasters"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 75816f0..ddf9c0c 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -263,6 +263,312 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("RefreshTokens"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.Property("Id") @@ -2029,6 +2335,179 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("User"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 048a0d2..d66615a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty -- 2.43.0 From e3dfcb4ee0e917c7b7004dcce2d960d5700d3734 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 17:51:57 +0530 Subject: [PATCH 040/469] Added DirectoryHelper in helper folder --- .../Dtos/Directory/CreateContactDto.cs | 3 +- .../Dtos/Directory/UpdateContactDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 ++- .../Controllers/DirectoryController.cs | 34 ++++++++++++------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 21 ++++++++++++ Marco.Pms.Services/Program.cs | 2 ++ 6 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 Marco.Pms.Services/Helpers/DirectoryHelper.cs diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 42937c0..6e962a4 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -6,7 +6,8 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } + public List? BucketIds { get; set; } + public Guid? ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 042150d..7c93cce 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -7,6 +7,7 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } + public List? BucketIds { get; set; } public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index d66615a..abf72d3 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -8,7 +8,7 @@ namespace Marco.Pms.Model.Mapper { public static class DirectoryMapper { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId, Guid employeeId) { return new Contact @@ -19,6 +19,8 @@ namespace Marco.Pms.Model.Mapper Description = createContactDto.Description ?? string.Empty, Organization = createContactDto?.Organization ?? string.Empty, Address = createContactDto != null ? createContactDto.Address : string.Empty, + CreatedById = employeeId, + CreatedAt = DateTime.UtcNow, TenantId = tenantId }; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b0de798..a2f984c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,26 +1,25 @@ -using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Dtos.Directory; -using MarcoBMS.Services.Helpers; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { - [Route("api/[controller]")] [ApiController] + [Route("api/[controller]")] + public class DirectoryController : ControllerBase { - private readonly ApplicationDbContext _context; + private readonly DirectoryHelper _directoryHelper; private readonly ILoggingService _logger; - private readonly UserHelper _userHelper; - public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + public DirectoryController(DirectoryHelper directoryHelper, ILoggingService logger) { - _context = context; + _directoryHelper = directoryHelper; _logger = logger; - _userHelper = userHelper; } [HttpGet] @@ -32,10 +31,21 @@ namespace Marco.Pms.Services.Controllers [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + return Ok(); } - { - return Ok(); + + + + } } -} diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs new file mode 100644 index 0000000..832d190 --- /dev/null +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -0,0 +1,21 @@ +using Marco.Pms.DataAccess.Data; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; + +namespace Marco.Pms.Services.Helpers +{ + public class DirectoryHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index 1d69193..dbd6912 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -3,6 +3,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Authentication; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using Marco.Pms.Services.Service; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Middleware; @@ -130,6 +131,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From 13d6bf94d9e6cb4e4cb81cadde9d1ce2faf60d4b Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 041/469] created GetListOfContact custome function --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../ViewModels/Directory/ContactVM.cs | 2 +- .../Controllers/DirectoryController.cs | 13 ++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 92 ++++++++++++++++++- 4 files changed, 105 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index abf72d3..fbe0e46 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index 6d6f82e..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.ViewModels.Directory public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a2f984c..efa76c3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,7 +25,18 @@ namespace Marco.Pms.Services.Controllers [HttpGet] public async Task GetContactList() { - return Ok(); + var response = await _directoryHelper.GetListOfContacts(); + + + if(response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 832d190..5e11587 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,6 +1,12 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; namespace Marco.Pms.Services.Helpers { @@ -17,5 +23,89 @@ namespace Marco.Pms.Services.Helpers _logger = logger; _userHelper = userHelper; } + + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + + List contactIds = contacts.Select(c=>c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); + + var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); + + + List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if(emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if(phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + + if (tagMappingss != null) { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag.ToContactTagVMFromContactTagMaster(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + + return ApiResponse.SuccessResponse(list, "Contact List !",200); + + } } -} + } -- 2.43.0 From 78f95d6f81a6a3480346de5af37cc5ed0d5722ec Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 042/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 2 +- .../Dtos/Directory/CreateContactPhoneDto.cs | 1 - .../Controllers/DirectoryController.cs | 11 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 110 ++++++++++++++++++ .../appsettings.Development.json | 2 +- 5 files changed, 121 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 68bb2b2..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,6 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } } } + diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index dc97881..a72ac3d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,6 +4,5 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index efa76c3..afcb061 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -51,8 +51,15 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("User sent Invalid Date while marking attendance"); return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); } - - return Ok(); + var response = await _directoryHelper.CreateContact(createContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5e11587..b1f6e9c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,5 +1,6 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; @@ -107,5 +108,114 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, "Contact List !",200); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json index 91af3c4..1522ad9 100644 --- a/Marco.Pms.Services/appsettings.Development.json +++ b/Marco.Pms.Services/appsettings.Development.json @@ -12,7 +12,7 @@ }, "ConnectionStrings": { //"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2" - "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS10" + "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSDev" }, "MongoDB": { "SerilogDatabaseUrl": "mongodb://localhost:27017/DotNetLogs" -- 2.43.0 From dbaabb1728cd61c7f209130942f0e6421ec33394 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 043/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 84 ------------------- 1 file changed, 84 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b1f6e9c..7ac80c4 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -25,90 +25,6 @@ namespace Marco.Pms.Services.Helpers _userHelper = userHelper; } - - - public async Task> GetListOfContacts() - { - Guid tenantId = _userHelper.GetTenantId(); - - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - - List contactIds = contacts.Select(c=>c.Id).ToList(); - - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - - var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); - - var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); - - - List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); - - var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); - - List list = new List(); - - foreach (var contact in contacts) - { - - ContactVM contactVM = new ContactVM(); - List contactEmailVms = new List(); - List contactPhoneVms = new List(); - - List conatctTagVms = new List(); - var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); - var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); - var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - - - if(emails != null) - { - foreach (var email in emails) - { - ContactEmailVM emailVM = new ContactEmailVM(); - emailVM = email.ToContactEmailVMFromContactEmail(); - contactEmailVms.Add(emailVM); - } - } - - if(phones != null) - { - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = new ContactPhoneVM(); - phoneVM = phone.ToContactPhoneVMFromContactPhone(); - contactPhoneVms.Add(phoneVM); - } - - } - - if (tagMappingss != null) { - foreach (var tagMapping in tagMappingss) - { - ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); - - tagVM = tag.ToContactTagVMFromContactTagMaster(); - conatctTagVms.Add(tagVM); - - - } - } - - - contactVM = contact.ToContactVMFromContact(); - - contactVM.ContactEmails = contactEmailVms; - contactVM.ContactPhones = contactPhoneVms; - contactVM.Tags = conatctTagVms; - - list.Add(contactVM); - } - - return ApiResponse.SuccessResponse(list, "Contact List !",200); - - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From dac586f4989e37d9550224ce77bdefc0ffbd28bd Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 044/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../Controllers/DirectoryController.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 81 ++++++++++++++++++- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index fbe0e46..b9e9f86 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index afcb061..b5ac7e5 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -2,12 +2,14 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { [ApiController] [Route("api/[controller]")] + [Authorize] public class DirectoryController : ControllerBase { @@ -28,7 +30,7 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetListOfContacts(); - if(response.StatusCode == 200) + if (response.StatusCode == 200) { return Ok(response); } @@ -36,7 +38,7 @@ namespace Marco.Pms.Services.Controllers { return BadRequest(response); } - + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 7ac80c4..c34d2ac 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -25,6 +25,85 @@ namespace Marco.Pms.Services.Helpers _userHelper = userHelper; } + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); + var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if (emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if (phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + if (tagMappingss != null) + { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + _logger.LogInfo("{count} contacts are fetched by Employee with ID {LoggedInEmployeeId}", list.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); + + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -134,4 +213,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From 84cfdc29b2f38b323a1d19d6175915f772fc47af Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 12:51:23 +0530 Subject: [PATCH 045/469] Created an API to create the Contact category --- .../Dtos/Master/CreateContactTagDto.cs | 1 + .../Dtos/Master/UpdateContactTagDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Master/ContactTagVM.cs | 1 + .../Controllers/MasterController.cs | 81 ++++++++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 54 +++++++++++++ Marco.Pms.Services/Program.cs | 1 + 7 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Services/Helpers/MasterHelper.cs diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs index ad91ca7..2fec4ae 100644 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -3,5 +3,6 @@ public class CreateContactTagDto { public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs index 0406a6c..e97ece6 100644 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b9e9f86..82e703f 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -125,6 +125,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagMaster { Name = createContactTagDto.Name ?? string.Empty, + Description = createContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -134,6 +135,7 @@ namespace Marco.Pms.Model.Mapper { Id = updateContactTagDto.Id, Name = updateContactTagDto.Name ?? string.Empty, + Description = updateContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -142,6 +144,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagVM { Id = contactTag.Id, + Description = contactTag.Description ?? string.Empty, Name = contactTag.Name ?? string.Empty, }; } diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs index 2cb6f8a..321b669 100644 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index b89dc91..0d0221b 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -9,6 +9,7 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Activities; using Marco.Pms.Model.ViewModels.Forum; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Authorization; @@ -25,11 +26,13 @@ namespace Marco.Pms.Services.Controllers private readonly ApplicationDbContext _context; private readonly UserHelper _userHelper; private readonly ILoggingService _logger; - public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger) + private readonly MasterHelper _masterHelper; + public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger, MasterHelper masterHelper) { _context = context; _userHelper = userHelper; _logger = logger; + _masterHelper = masterHelper; } // -------------------------------- Activity -------------------------------- @@ -667,5 +670,81 @@ namespace Marco.Pms.Services.Controllers return NotFound(ApiResponse.ErrorResponse("Work category not found", "Work category not found", 404)); } } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-categories")] + public async Task GetContactCategoryMasterList() + { + return Ok(); + } + + [HttpGet("contact-category/{id})")] + public async Task GetContactCategoryMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-category")] + public async Task CreateContactCategoryMaster([FromBody] CreateContactCategoryDto contactCategoryDto) + { + var response = await _masterHelper.CreateContactCategory(contactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPost("contact-category/edit/{id}")] + public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) + { + return Ok(); + } + + [HttpDelete("contact-category/{id}")] + public async Task DeletecontactCategoryMaster(Guid id) + { + return Ok(); + } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-tags")] + public async Task GetContactTagMasterList() + { + return Ok(); + } + + [HttpGet("contact-tag/{id})")] + public async Task GetContactTagMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-tag")] + public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) + { + return Ok(); + } + + [HttpPost("contact-tag/edit/{id}")] + public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) + { + return Ok(); + } + + [HttpDelete("contact-tag/{id}")] + public async Task DeletecontactTagMaster(Guid id) + { + return Ok(); + } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs new file mode 100644 index 0000000..893eee2 --- /dev/null +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -0,0 +1,54 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Master; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; + +namespace Marco.Pms.Services.Helpers +{ + public class MasterHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public MasterHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + // -------------------------------- Contact Category -------------------------------- + public async Task> CreateContactCategory(CreateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactCategoryDto.Name != null ? contactCategoryDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactCategoryMaster contactCategory = contactCategoryDto.ToContactCategoryMasterFromCreateContactCategoryDto(tenantId); + _context.ContactCategoryMasters.Add(contactCategory); + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact category.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category already existed", "Category already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + // -------------------------------- Contact Tag -------------------------------- + // -------------------------------- Bucket -------------------------------- + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index dbd6912..4cb3abf 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -132,6 +132,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From c2223e4029d52d12d05dd5d4f124e3dc5934f6a5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 046/469] Created an endpoint to fetch list of all contact category in that tenant --- .../Controllers/MasterController.cs | 5 +++-- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 0d0221b..fe0f1e9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -676,7 +676,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-categories")] public async Task GetContactCategoryMasterList() { - return Ok(); + var response = await _masterHelper.GetContactCategoriesList(); + return Ok(response); } [HttpGet("contact-category/{id})")] @@ -715,7 +716,7 @@ namespace Marco.Pms.Services.Controllers return Ok(); } - // -------------------------------- Contact Category -------------------------------- + // -------------------------------- Contact Tag -------------------------------- [HttpGet("contact-tags")] public async Task GetContactTagMasterList() diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 893eee2..75c6d5f 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -48,6 +48,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- // -------------------------------- Bucket -------------------------------- } -- 2.43.0 From 711b47ddf41dc6549279ba93d1d0d88c91474f84 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 047/469] Added an API to update existing contact --- .../Dtos/Directory/ContactTagDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactEmailDto.cs | 2 +- .../Dtos/Directory/UpdateContactPhoneDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +- .../Controllers/DirectoryController.cs | 18 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 8 files changed, 258 insertions(+), 13 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs new file mode 100644 index 0000000..12b0223 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactTagDto + { + public Guid? Id { get; set; } + public string Name { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 6e962a4..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -11,6 +11,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 7c93cce..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -12,6 +12,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs index 8ece036..186f5b3 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactEmailDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? EmailAddress { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs index 1ddfb14..ff0ec23 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactPhoneDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? PhoneNumber { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 82e703f..9b5c835 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -68,7 +68,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactPhone { - Id = updateContactPhoneDto.Id, + Id = updateContactPhoneDto.Id ?? Guid.Empty, Label = updateContactPhoneDto.Label ?? string.Empty, PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, ContactId = contactId, @@ -101,7 +101,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactEmail { - Id = updateContactEmailDto.Id, + Id = updateContactEmailDto.Id ?? Guid.Empty, Label = updateContactEmailDto.Label ?? string.Empty, EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, ContactId = contactId, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b5ac7e5..fe82bce 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -64,7 +64,23 @@ namespace Marco.Pms.Services.Controllers } } - + [HttpPut("{id}")] + public async Task UpdateContact(Guid id, [FromBody] UpdateContactDto updateContact) + { + var response = await _directoryHelper.UpdateContact(id, updateContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c34d2ac..81f419c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -162,17 +162,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -209,8 +224,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From c803a570c47ddcb67a6edea7b1ece5b197d221e8 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 048/469] added api to get list of contact tag --- .../Controllers/MasterController.cs | 3 ++- Marco.Pms.Services/Helpers/MasterHelper.cs | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index fe0f1e9..4df3a62 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -721,7 +721,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-tags")] public async Task GetContactTagMasterList() { - return Ok(); + var response = await _masterHelper.GetContactTags(); + return Ok(response); } [HttpGet("contact-tag/{id})")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 75c6d5f..ca1bbde 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -65,6 +66,23 @@ namespace Marco.Pms.Services.Helpers } // -------------------------------- Contact Tag -------------------------------- + + + public async Task> GetContactTags() + { + Guid tenantId = _userHelper.GetTenantId(); + + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + List contactTags = new List(); + foreach (var tag in taglist) { + ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); + contactTags.Add(tagVm); + } + _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + } // -------------------------------- Bucket -------------------------------- } } -- 2.43.0 From ccd28908d0a7da1c565c96274b3c822969b9ff95 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 049/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 11 ++++++++++ .../ViewModels/Directory/BucketVM.cs | 9 ++++++++ .../Controllers/DirectoryController.cs | 6 +++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/BucketVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 9b5c835..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -178,5 +178,16 @@ namespace Marco.Pms.Model.Mapper Description = contactType.Description ?? string.Empty, }; } + + // Bucket + public static BucketVM ToBucketVMFromBucket(this Bucket bucket) + { + return new BucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs new file mode 100644 index 0000000..ce9ed9e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class BucketVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fe82bce..65ccd2d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -83,5 +83,11 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("buckets")] + public async Task GetBucketList() + { + var response = await _directoryHelper.GetBucketList(); + return Ok(response); + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 81f419c..5d8e0b7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -433,5 +433,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From d86a85389ef4eaf5df5d1179bc032d6bf6219237 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 050/469] Added an API to create a contact tag --- .../Controllers/MasterController.cs | 23 ++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 34 ++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 4df3a62..8e4a86f 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -734,7 +734,28 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag")] public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) { - return Ok(); + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _masterHelper.CreateContactTag(contactTagDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-tag/edit/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ca1bbde..1906ec2 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -76,13 +75,38 @@ namespace Marco.Pms.Services.Helpers var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); List contactTags = new List(); - foreach (var tag in taglist) { + foreach (var tag in taglist) + { ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); contactTags.Add(tagVm); } _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count), 200); } - // -------------------------------- Bucket -------------------------------- + public async Task> CreateContactTag(CreateContactTagDto contactTagDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); + _context.ContactTagMasters.Add(contactTag); + await _context.SaveChangesAsync(); + ContactTagVM tagVM = contactTag.ToContactTagVMFromContactTagMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact tag {ContactTagId}.", LoggedInEmployee.Id, contactTag.Id); + return ApiResponse.SuccessResponse(tagVM, "Tag Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact tag.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Tag already existed", "Tag already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + } } -- 2.43.0 From 22be364a0a7c2c263ac569ae570bcf5d194639e1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:38:24 +0530 Subject: [PATCH 051/469] Fixed the errorof finding tag in wrong table --- Marco.Pms.Services/Helpers/MasterHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 1906ec2..66d3b45 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -89,8 +89,8 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (contactTagDto != null) { - ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); - if (existingContactCategory == null) + ContactTagMaster? existingContactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactTag == null) { ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); _context.ContactTagMasters.Add(contactTag); -- 2.43.0 From ccf339ca0bf853f35ac27f43d2d9024042f583ae Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 052/469] Added an API to create bucket --- .../Dtos/Directory/CreateBucketDto.cs | 4 +- .../Controllers/DirectoryController.cs | 28 ++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs index ba0918d..0c02457 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -2,7 +2,7 @@ { public class CreateBucketDto { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 65ccd2d..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -89,5 +89,33 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetBucketList(); return Ok(response); } + + [HttpPost("bucket")] + public async Task CreateBucket(CreateBucketDto bucketDto) + { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _directoryHelper.CreateBucket(bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5d8e0b7..704a0d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -455,5 +455,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From b50cda12b89557faf6de97ad81e80bffb2657088 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 053/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 704a0d0..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -377,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From e78cc742463bc8dabe47a75fe2ff89821d47cd2c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 054/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3415 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 54fd3c3..e305c2e 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -100,6 +100,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index ddf9c0c..329b474 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2450,6 +2473,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..46d0482 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..aa1ef35 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,6 +41,24 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 326ceecdbf7d7deb19495270452cc84c075eb5bb Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 055/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 23 insertions(+), 3415 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index e305c2e..54fd3c3 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -100,7 +100,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 329b474..ddf9c0c 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,6 +320,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -475,32 +478,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2473,33 +2450,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -42,6 +44,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index aa1ef35..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,24 +41,6 @@ namespace Marco.Pms.Services.Controllers } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,19 +31,13 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - - List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -61,10 +55,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -74,7 +67,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -84,7 +77,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -97,17 +90,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -119,102 +104,6 @@ namespace Marco.Pms.Services.Helpers } - public async Task> GetContactsListByBucketId(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); - if (employeeBucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); - } - List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); - List contactVMs = new List(); - if (contactBucket.Count > 0) - { - var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); - List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); - List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); - - List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); - List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - - List tagIds = new List(); - List tagMasters = new List(); - if (tags.Count > 0) - { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); - tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - } - - if (contacts.Count > 0) - { - - - foreach (var contact in contacts) - { - List? emailVMs = new List(); - List? phoneVMs = new List(); - List? tagVMs = new List(); - - List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); - List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); - - List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); - List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); - List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); - - if (contactPhones.Count > 0) - { - foreach (var phone in contactPhones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - } - if (contactEmails.Count > 0) - { - foreach (var email in contactEmails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - } - if (contactTags.Count > 0) - { - foreach (var contactTag in contactTags) - { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); - if (tagMaster != null) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - } - } - ContactVM contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = emailVMs; - contactVM.ContactPhones = phoneVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - contactVMs.Add(contactVM); - } - } - - } - _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -234,8 +123,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -258,7 +145,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -274,29 +160,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -314,8 +179,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -326,20 +190,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -365,8 +221,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -385,7 +239,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -405,9 +259,6 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -495,33 +346,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } - if (updateContact.ProjectIds != null) - { - foreach (var ProjectId in updateContact.ProjectIds) - { - if (!projectIds.Contains(ProjectId)) - { - _context.ContactProjectMappings.Add(new ContactProjectMapping - { - ProjectId = ProjectId, - ContactId = contact.Id - }); - } - } - - foreach (var projectMapping in contactProjects) - { - if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) - { - _context.ContactProjectMappings.Remove(projectMapping); - } - } - } - else if (contactProjects != null) - { - _context.ContactProjectMappings.RemoveRange(contactProjects); - } - if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -540,8 +364,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -554,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -576,10 +399,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -608,9 +427,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 54d6d5f1bd9ecfc08b956f39926071c3d9e48159 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 056/469] Added an API to delete existing contact category --- .../Controllers/MasterController.cs | 3 +- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 8e4a86f..e782913 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -713,7 +713,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-category/{id}")] public async Task DeletecontactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactCategory(id); + return Ok(response); } // -------------------------------- Contact Tag -------------------------------- diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 66d3b45..33fab6b 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -63,6 +63,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 38e5ad664eb9f5d70e8b66561f508597e6b9991f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 057/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...63809_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 17 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3414 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 54fd3c3..13cd596 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -101,6 +101,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } + public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..18a4be6 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517063809_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index ddf9c0c..329b474 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2450,6 +2473,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..bd49e18 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -40,6 +40,23 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 8c938b545e5b979fc54e547bd93761a37d1d5c61 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:28:54 +0530 Subject: [PATCH 058/469] Refetched the contact in update contact API --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..ff3f730 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -393,6 +393,7 @@ namespace Marco.Pms.Services.Helpers } var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + _context.Contacts.Update(newContact); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -573,6 +574,7 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 8288a19dd85665a1eb1386cb70747d4c27a81672 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 059/469] properly mapped the updated Dto to contact table --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..f78c260 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -23,7 +23,7 @@ namespace Marco.Pms.Model.Mapper TenantId = tenantId }; } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId, Contact contact) { return new Contact @@ -31,6 +31,8 @@ namespace Marco.Pms.Model.Mapper Id = updateContactDto.Id, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, + CreatedAt = contact.CreatedAt, + CreatedById = contact.CreatedById, Description = updateContactDto.Description ?? string.Empty, Organization = updateContactDto?.Organization ?? string.Empty, Address = updateContactDto != null ? updateContactDto.Address : string.Empty, diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ff3f730..f1100c6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -385,15 +385,16 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.AsNoTracking().FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); + await _context.SaveChangesAsync(); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -505,7 +506,8 @@ namespace Marco.Pms.Services.Helpers _context.ContactProjectMappings.Add(new ContactProjectMapping { ProjectId = ProjectId, - ContactId = contact.Id + ContactId = contact.Id, + TenantId = tenantId }); } } @@ -572,7 +574,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From c330023ee7b77a672cc57baf6cfd90803b4e0326 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 060/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f1100c6..d866509 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -36,7 +36,7 @@ namespace Marco.Pms.Services.Helpers List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); @@ -118,7 +118,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -233,6 +232,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); @@ -301,14 +301,14 @@ namespace Marco.Pms.Services.Helpers { foreach (var tag in createContact.Tags) { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) + if (tagNames.Contains(tag.Name.ToLower())) { - ContactTagMapping tagMapping = new ContactTagMapping + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); + _context.ContactTagMappings.Add(new ContactTagMapping { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); + ContactId = contact.Id, + ContactTagtId = tag.Id ?? existingTag.Id + }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) { @@ -373,7 +373,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -407,10 +406,12 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -530,12 +531,13 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + if (tagNames.Contains(tag.Name.ToLower())) { + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id.Value + ContactTagtId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -574,19 +576,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From c16f9a08d9782866bc0b15f0fbceaba5d882c956 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 14:33:14 +0530 Subject: [PATCH 061/469] Added an API to deleted ContactTag as well remove entries in contact-tag mapping table related to that tag --- .../Controllers/MasterController.cs | 7 ++--- Marco.Pms.Services/Helpers/MasterHelper.cs | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index e782913..1ba1ee9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -680,7 +680,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-category/{id})")] + [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { return Ok(); @@ -726,7 +726,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-tag/{id})")] + [HttpGet("contact-tag/{id}")] public async Task GetContactTagMaster(Guid id) { return Ok(); @@ -768,7 +768,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-tag/{id}")] public async Task DeletecontactTagMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactTag(id); + return Ok(response); } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 33fab6b..ac05b97 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -139,7 +139,33 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactTag(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactTag != null) + { + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + _context.ContactTagMasters.Remove(contactTag); + if (tagMappings.Any()) + { + _context.ContactTagMappings.RemoveRange(tagMappings); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact tag {ContactTagId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Tag {ContactTagId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Tag deleted successfully", 200); + } } } -- 2.43.0 From 18067732edf9a358b0246a3036460417cdefbef6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:13:35 +0530 Subject: [PATCH 062/469] added an API to get a list of contact-notes by contact ID --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 22 ++++++ .../ViewModels/Directory/ContactNoteVM.cs | 9 +++ .../Controllers/DirectoryController.cs | 67 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 +++++++ 4 files changed, 121 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index f78c260..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -188,5 +188,27 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + + //Contact Note + public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) + { + return new ContactNote + { + Note = noteDto.Note, + ContactId = noteDto.ContactId, + CreatedAt = DateTime.UtcNow, + CreatedById = employeeId, + TenantId = tenantId + }; + } + public static ContactNoteVM ToContactNoteVMFromContactNote(this ContactNote note) + { + return new ContactNoteVM + { + Id = note.Id, + Note = note.Note, + ContactId = note.ContactId + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs new file mode 100644 index 0000000..5e1c340 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactNoteVM + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index bd49e18..dd3785e 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,73 @@ namespace Marco.Pms.Services.Controllers } } + // -------------------------------- Contact Notes -------------------------------- + + [HttpPost("note")] + public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.CreateContactNote(noteDto); + //if (response.StatusCode == 200) + //{ + //return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpGet("note/{ContactId}")] + public async Task GetNoteListByContactId(Guid contactId) + { + var response = await _directoryHelper.GetNoteListByContactId(contactId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPut("note/{id}")] + public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.UpdateContactNote(id, noteDto); + //if (response.StatusCode == 200) + //{ + // return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpDelete("note/{id}")] + public async Task DeleteContactNote(Guid id) + { + return Ok(); + //var response = await _directoryHelper.DeleteContactNote(id); + //return Ok(response); + } + + // -------------------------------- Bucket -------------------------------- [HttpGet("buckets")] public async Task GetBucketList() diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d866509..b68a854 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -624,6 +624,29 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + // -------------------------------- Contact Notes -------------------------------- + + public async Task> GetNoteListByContactId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + noteVMs.Add(noteVM); + } + _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 0685a12c6297676bad1ddf5940b6978756035064 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 063/469] Added an API to get contact category by its size --- .../Controllers/MasterController.cs | 14 +++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 1ba1ee9..61baaa3 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -683,7 +683,19 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.GetContactCategoryById(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-category")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ac05b97..11015c8 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -47,7 +47,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -63,6 +62,22 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> GetContactCategoryById(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var category = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (category != null) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + _logger.LogInfo("Employee {EmployeeId} fetched contact category {ContactCategoryID}", LoggedInEmployee.Id, category.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category fetched successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} attempted to fetch contact category {ContactCategoryID} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } public async Task> DeleteContactCategory(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 1be23802c7b8f2072b9aa3c82ee572fa75085d0d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 064/469] Added an API to Update existing Contact-note --- .../Controllers/DirectoryController.cs | 60 +++++++++---------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 ++++++++++++ 2 files changed, 67 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index dd3785e..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -104,20 +104,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("note")] public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.CreateContactNote(noteDto); - //if (response.StatusCode == 200) - //{ - //return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + + var response = await _directoryHelper.CreateContactNote(noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpGet("note/{ContactId}")] @@ -141,28 +141,26 @@ namespace Marco.Pms.Services.Controllers [HttpPut("note/{id}")] public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.UpdateContactNote(id, noteDto); - //if (response.StatusCode == 200) - //{ - // return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + var response = await _directoryHelper.UpdateContactNote(id, noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("note/{id}")] public async Task DeleteContactNote(Guid id) { - return Ok(); - //var response = await _directoryHelper.DeleteContactNote(id); - //return Ok(response); + var response = await _directoryHelper.DeleteContactNote(id); + return Ok(response); } // -------------------------------- Bucket -------------------------------- diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b68a854..a185a1d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -647,6 +647,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 37eba7a47f370c5f2d1db1ceb2871e4b6559a299 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 065/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a185a1d..9861a15 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -684,6 +684,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 6d38e005bc9f576764209c670ba23be3ba3fb762 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:43 +0530 Subject: [PATCH 066/469] Added an API to add a note to specific contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9861a15..ebaeb4e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -646,7 +646,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - + public async Task> CreateContactNote(CreateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote note = noteDto.ToContactNoteFromCreateContactNoteDto(tenantId, LoggedInEmployee.Id); + _context.ContactNotes.Add(note); + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + _logger.LogInfo("Employee {EmployeeId} Added note at contact {ContactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note added successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to add a note to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 24d2cbbfcee971ed338da3f78cfe5b97bbb3bff7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 10:57:17 +0530 Subject: [PATCH 067/469] Corrected the typo of ContactTagtId to ContactTagId --- ...Added_Directory_Related_Tables.Designer.cs | 3 --- ...14103249_Added_Directory_Related_Tables.cs | 6 ++--- ...ed_ContactProjectMapping_Table.Designer.cs | 2 -- .../ApplicationDbContextModelSnapshot.cs | 3 --- .../Directory/ContactTagMapping.cs | 2 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 26 +++++++++---------- Marco.Pms.Services/Helpers/MasterHelper.cs | 2 +- 7 files changed, 17 insertions(+), 27 deletions(-) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs index f50346e..aad7361 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -493,9 +493,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - b.HasKey("Id"); b.HasIndex("ContactId"); diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs index 879f54b..7ef6da4 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable @@ -289,8 +288,7 @@ namespace Marco.Pms.DataAccess.Migrations { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + ContactTagId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs index 18a4be6..492cf00 100644 --- a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -516,8 +516,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); b.HasKey("Id"); diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 329b474..5662c46 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -513,9 +513,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - b.HasKey("Id"); b.HasIndex("ContactId"); diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs index a3d7e9e..91c2835 100644 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -5,7 +5,7 @@ public Guid Id { get; set; } public Guid ContactId { get; set; } public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } + public Guid ContactTagId { get; set; } public ContactTagMaster? ContactTag { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ebaeb4e..04b0785 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Services.Helpers var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + List TagIds = Tags.Select(t => t.ContactTagId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -89,7 +89,7 @@ namespace Marco.Pms.Services.Helpers foreach (var tagMapping in tagMappingss) { ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); conatctTagVms.Add(tagVM); @@ -147,7 +147,7 @@ namespace Marco.Pms.Services.Helpers List tagMasters = new List(); if (tags.Count > 0) { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagIds = tags.Select(ct => ct.ContactTagId).ToList(); tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); } @@ -188,7 +188,7 @@ namespace Marco.Pms.Services.Helpers { foreach (var contactTag in contactTags) { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagId); if (tagMaster != null) { ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); @@ -307,7 +307,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) @@ -320,7 +320,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = newtag.Id, + ContactTagId = newtag.Id, ContactId = contact.Id }; contactTagMappings.Add(tagMapping); @@ -336,7 +336,7 @@ namespace Marco.Pms.Services.Helpers List phoneVMs = new List(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + var tagIds = contactTagMappings.Select(t => t.ContactTagId).ToList(); tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); @@ -355,7 +355,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTagMappings) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } @@ -404,7 +404,7 @@ namespace Marco.Pms.Services.Helpers var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); @@ -537,7 +537,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -553,7 +553,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = contactTag.Id + ContactTagId = contactTag.Id }); } } @@ -584,7 +584,7 @@ namespace Marco.Pms.Services.Helpers contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); @@ -604,7 +604,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTags) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 11015c8..4d29908 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -161,7 +161,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contactTag != null) { - List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagId == contactTag.Id).ToListAsync(); _context.ContactTagMasters.Remove(contactTag); if (tagMappings.Any()) -- 2.43.0 From 9767390636ab19350fa4e2d997165e39d148791b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 11:09:30 +0530 Subject: [PATCH 068/469] Addd migrations fro Typo --- ...53019_Fixed_Typo_Of_ColumnName.Designer.cs | 3007 +++++++++++++++++ ...20250519053019_Fixed_Typo_Of_ColumnName.cs | 64 + .../ApplicationDbContextModelSnapshot.cs | 6 +- 3 files changed, 3075 insertions(+), 2 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs diff --git a/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs new file mode 100644 index 0000000..39fe4c3 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs @@ -0,0 +1,3007 @@ +// +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("20250519053019_Fixed_Typo_Of_ColumnName")] + partial class Fixed_Typo_Of_ColumnName + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Grants a user the ability to record their own work hours or presence within the system. This typically involves checking in and checking out, logging break times, and potentially viewing their own attendance history.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage 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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs new file mode 100644 index 0000000..5b33d21 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Fixed_Typo_Of_ColumnName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings"); + + migrationBuilder.AlterColumn( + name: "ContactTagId", + table: "ContactTagMappings", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci", + oldClrType: typeof(Guid), + oldType: "char(36)", + oldNullable: true) + .OldAnnotation("Relational:Collation", "ascii_general_ci"); + + migrationBuilder.AddForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId", + principalTable: "ContactTagMasters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings"); + + migrationBuilder.AlterColumn( + name: "ContactTagId", + table: "ContactTagMappings", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci", + oldClrType: typeof(Guid), + oldType: "char(36)") + .OldAnnotation("Relational:Collation", "ascii_general_ci"); + + migrationBuilder.AddForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId", + principalTable: "ContactTagMasters", + principalColumn: "Id"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 5662c46..bbd22d7 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -510,7 +510,7 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactId") .HasColumnType("char(36)"); - b.Property("ContactTagId") + b.Property("ContactTagId") .HasColumnType("char(36)"); b.HasKey("Id"); @@ -2507,7 +2507,9 @@ namespace Marco.Pms.DataAccess.Migrations b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") .WithMany() - .HasForeignKey("ContactTagId"); + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); b.Navigation("Contact"); -- 2.43.0 From 5693bbba179a56c57bf74275ad490164096fb071 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 13:18:32 +0530 Subject: [PATCH 069/469] Changed tag validation --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 04b0785..f8009b8 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -411,7 +411,8 @@ namespace Marco.Pms.Services.Helpers var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); + List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -531,7 +532,10 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tagNames.Contains(tag.Name.ToLower())) + var namecheck = tagNames.Contains(tag.Name.ToLower()); + var idCheck = (!tagIds.Contains(tag.Id ?? Guid.Empty)); + var test = namecheck && idCheck; + if (test) { ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping @@ -559,7 +563,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 6eea98c5a1939c676ab0f40a99f0f3ed33324654 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 09:46:03 +0530 Subject: [PATCH 070/469] Created an API to get contact profile by its Id --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 18 ++- .../ViewModels/Directory/ContactNoteVM.cs | 8 +- .../ViewModels/Directory/ContactProfileVM.cs | 26 ++++ .../ViewModels/Projects/BasicProjectVM.cs | 8 ++ .../Controllers/DirectoryController.cs | 14 ++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 121 +++++++++++++++++- 6 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -51,6 +51,20 @@ namespace Marco.Pms.Model.Mapper Address = contact.Address ?? string.Empty }; } + public static ContactProfileVM ToContactProfileVMFromContact(this Contact contact) + { + return new ContactProfileVM + { + Id = contact.Id, + Name = contact.Name, + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty, + CreatedAt = contact.CreatedAt, + CreatedBy = contact.CreatedBy != null ? contact.CreatedBy.ToBasicEmployeeVMFromEmployee() : null + }; + } //Contact Phone Mapper public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) @@ -207,7 +221,9 @@ namespace Marco.Pms.Model.Mapper { Id = note.Id, Note = note.Note, - ContactId = note.ContactId + ContactId = note.ContactId, + CreatedAt = note.CreatedAt, + CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null }; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs index 5e1c340..c3ca209 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -1,9 +1,15 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class ContactNoteVM { public Guid Id { get; set; } public string Note { get; set; } = string.Empty; + public DateTime CreatedAt { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } + public DateTime? UpdatedAt { get; set; } + public BasicEmployeeVM? UpdatedBy { get; set; } public Guid ContactId { get; set; } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs new file mode 100644 index 0000000..8103c5c --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs @@ -0,0 +1,26 @@ +using Marco.Pms.Model.ViewModels.Activities; +using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Model.ViewModels.Projects; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactProfileVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public DateTime CreatedAt { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } + public DateTime? UpdatedAt { get; set; } + public BasicEmployeeVM? UpdatedBy { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } + public List? Projects { get; set; } + public List? Buckets { get; set; } + public List? Tags { get; set; } + public List? Notes { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs b/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs new file mode 100644 index 0000000..e08caa9 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Projects +{ + public class BasicProjectVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..12317d3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,20 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("profile/{id}")] + public async Task GetContactProfile(Guid id) + { + var response = await _directoryHelper.GetContactProfile(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 04b0785..c2f8345 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2,9 +2,11 @@ using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Projects; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Model.ViewModels.Projects; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.EntityFrameworkCore; @@ -213,7 +215,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -623,6 +624,121 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactProfile(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.Include(c => c.ContactCategory).Include(c => c.CreatedBy).FirstOrDefaultAsync(c => c.Id == id && c.IsActive); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + ContactProfileVM contactVM = contact.ToContactProfileVMFromContact(); + DirectoryUpdateLog? updateLog = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => l.RefereanceId == contact.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefaultAsync(); + if (updateLog != null) + { + contactVM.UpdatedAt = updateLog.UpdateAt; + contactVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + + List? phones = await _context.ContactsPhones.Where(p => p.ContactId == contact.Id).ToListAsync(); + if (phones.Any()) + { + List? phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + contactVM.ContactPhones = phoneVMs; + } + + List? emails = await _context.ContactsEmails.Where(e => e.ContactId == contact.Id).ToListAsync(); + if (emails.Any()) + { + List? emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + contactVM.ContactEmails = emailVMs; + } + + List? contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + if (contactProjects.Any()) + { + List projectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + List? projects = await _context.Projects.Where(p => projectIds.Contains(p.Id) && p.TenantId == tenantId).ToListAsync(); + List? projectVMs = new List(); + foreach (var project in projects) + { + BasicProjectVM projectVM = new BasicProjectVM + { + Id = project.Id, + Name = project.Name + }; + projectVMs.Add(projectVM); + } + contactVM.Projects = projectVMs; + } + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + if (contactBuckets.Any() && employeeBuckets.Any()) + { + List contactBucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + List employeeBucketIds = employeeBuckets.Select(eb => eb.BucketId).ToList(); + List? buckets = await _context.Buckets.Where(b => contactBucketIds.Contains(b.Id) && employeeBucketIds.Contains(b.Id)).ToListAsync(); + List? bucketVMs = new List(); + foreach (var bucket in buckets) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + contactVM.Buckets = bucketVMs; + } + List? contactTags = await _context.ContactTagMappings.Where(ct => ct.ContactId == contact.Id).ToListAsync(); + if (contactTags.Any()) + { + List tagIds = contactTags.Select(ct => ct.ContactTagId).ToList(); + List tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + List tagVMs = new List(); + foreach (var tagMaster in tagMasters) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + contactVM.Tags = tagVMs; + } + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + if (notes.Any()) + { + List? noteIds = notes.Select(n => n.Id).ToList(); + List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.Id)).OrderByDescending(l => l.UpdateAt).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + DirectoryUpdateLog? noteUpdateLog = noteUpdateLogs.Where(n => n.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + if (noteUpdateLog != null) + { + noteVM.UpdatedAt = noteUpdateLog.UpdateAt; + noteVM.UpdatedBy = noteUpdateLog.Employee != null ? noteUpdateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + noteVMs.Add(noteVM); + } + contactVM.Notes = noteVMs; + } + _logger.LogInfo("Employee ID {EmployeeId} fetched profile of contact {COntactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact profile fetched successfully"); + + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- @@ -691,7 +807,8 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - + noteVM.UpdatedAt = DateTime.UtcNow; + noteVM.UpdatedBy = LoggedInEmployee.ToBasicEmployeeVMFromEmployee(); _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); -- 2.43.0 From d8d234a838e0846e6f85fa69a4c25197779c16d3 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 12:38:09 +0530 Subject: [PATCH 071/469] changed all list in contact profile view model to non-nullable and set default value to empty list --- .../ViewModels/Directory/ContactProfileVM.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs index 8103c5c..9e8f4cb 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs @@ -15,12 +15,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public BasicEmployeeVM? CreatedBy { get; set; } public DateTime? UpdatedAt { get; set; } public BasicEmployeeVM? UpdatedBy { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } + public List ContactPhones { get; set; } = new List(); + public List ContactEmails { get; set; } = new List(); public ContactCategoryVM? ContactCategory { get; set; } - public List? Projects { get; set; } - public List? Buckets { get; set; } - public List? Tags { get; set; } - public List? Notes { get; set; } + public List Projects { get; set; } = new List(); + public List Buckets { get; set; } = new List(); + public List Tags { get; set; } = new List(); + public List Notes { get; set; } = new List(); } } -- 2.43.0 From 9fbf55eeb58f518169343a75628ad9674a1686fb Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 10:28:17 +0530 Subject: [PATCH 072/469] Implemented an API to retrieve a list of organizations provided in the contacts. --- Marco.Pms.Services/Controllers/DirectoryController.cs | 7 +++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 12317d3..8f2cb5c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -113,6 +113,13 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("organization")] + public async Task GetOrganizationList() + { + var response = await _directoryHelper.GetOrganizationList(); + return Ok(response); + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 20e21a7..51ca0d8 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -743,6 +743,15 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); } + public async Task> GetOrganizationList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var organizationList = await _context.Contacts.Where(c => c.TenantId == tenantId).Select(c => c.Organization).Distinct().ToListAsync(); + _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); + return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From 9224aca3ff5112bb13dcc6b1652cae622b5154a0 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Tue, 20 May 2025 10:00:57 +0530 Subject: [PATCH 073/469] created api for contact Tag Update --- .../Controllers/MasterController.cs | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 61baaa3..36a3ee8 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,6 +1,8 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -638,8 +640,7 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - _logger.LogError("User sent empyt payload"); - return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); + } [HttpDelete("work-category/{id}")] @@ -774,7 +775,36 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag/edit/{id}")] public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) { - return Ok(); + + var tenantId = _userHelper.GetTenantId(); + Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContactTagDto != null && updateContactTagDto.Id != id) + { + ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); + if(contactTag != null) + { + contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); + _context.ContactTagMasters.Update(contactTag); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactTag.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + + ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); + + + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); + return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); + } + } + _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); + return NotFound(ApiResponse.ErrorResponse("Contact Tag master not found", "Work category master not found", 404)); + } [HttpDelete("contact-tag/{id}")] -- 2.43.0 From fe5e58dce03cde1066485c2de4ab1009563b17f1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 17:29:20 +0530 Subject: [PATCH 074/469] Implemented an API to suspend a Contact --- .../Controllers/DirectoryController.cs | 22 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 8f2cb5c..843aacb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -107,6 +107,10 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 404) + { + return NotFound(response); + } else { return BadRequest(response); @@ -120,6 +124,24 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } + [HttpDelete("{id}")] + public async Task DeleteContact(Guid id) + { + var response = await _directoryHelper.DeleteContact(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 51ca0d8..df5fbc9 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -752,6 +752,26 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } + public async Task> DeleteContact(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + contact.IsActive = false; + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From bb561187fbe22354b90b7d7994b2e00adc541f5e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 13:05:08 +0000 Subject: [PATCH 075/469] Update Marco.Pms.Services/Helpers/DirectoryHelper.cs Added entrie to DirectoryUpdateLog Table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index df5fbc9..bb2e839 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -765,6 +765,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } contact.IsActive = false; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); -- 2.43.0 From 23e8eedf173e794d8dcc15be8772b50dd3541fd1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 17:26:51 +0530 Subject: [PATCH 076/469] Implemented filtering functionality for Get Contact List API --- .../Dtos/Directory/ContactFilterDto.cs | 9 ++++ .../Controllers/DirectoryController.cs | 4 +- .../Controllers/MasterController.cs | 9 ++-- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 42 +++++++++++++++++-- 4 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs new file mode 100644 index 0000000..3f06388 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactFilterDto + { + public List? BucketIds { get; set; } + public List? CategoryIds { get; set; } + + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 843aacb..2e6db54 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList() + public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(); + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); if (response.StatusCode == 200) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 36a3ee8..dc4cd61 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -640,7 +640,8 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - + _logger.LogError("User sent empyt payload"); + return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); } [HttpDelete("work-category/{id}")] @@ -781,7 +782,7 @@ namespace Marco.Pms.Services.Controllers if (updateContactTagDto != null && updateContactTagDto.Id != id) { ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); - if(contactTag != null) + if (contactTag != null) { contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); _context.ContactTagMasters.Update(contactTag); @@ -796,8 +797,8 @@ namespace Marco.Pms.Services.Controllers ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); - - + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index bb2e839..dc82f01 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -29,17 +29,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts() + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - + if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) + { + bucketIds = filterDto.BucketIds; + } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + List contacts = new List(); + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) + { + var categoryIds = filterDto.CategoryIds; + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && categoryIds.Contains(c.ContactCategoryId ?? Guid.Empty) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } + else + { + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); @@ -50,6 +62,19 @@ namespace Marco.Pms.Services.Helpers var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + if (search != null && search != string.Empty) + { + List filteredContactIds = new List(); + phoneNo = phoneNo.Where(p => Compare(p.PhoneNumber, search)).ToList(); + filteredContactIds = phoneNo.Select(p => p.ContactId).ToList(); + + Emails = Emails.Where(e => Compare(e.EmailAddress, search)).ToList(); + filteredContactIds.AddRange(Emails.Select(e => e.ContactId).ToList()); + filteredContactIds = filteredContactIds.Distinct().ToList(); + + contacts = contacts.Where(c => Compare(c.Name, search) || Compare(c.Organization, search) || filteredContactIds.Contains(c.Id)).ToList(); + } + List list = new List(); foreach (var contact in contacts) @@ -66,6 +91,7 @@ namespace Marco.Pms.Services.Helpers var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); + if (emails != null && emails.Count > 0) { foreach (var email in emails) @@ -944,5 +970,15 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + private bool Compare(string sentence, string search) + { + sentence = sentence.Trim().ToLower(); + search = search.Trim().ToLower(); + + // Check for exact substring + bool result = sentence.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; + return result; + } } } -- 2.43.0 From 95aef84a3a70b42306f223d6f12337738f17be08 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 22:10:51 +0530 Subject: [PATCH 077/469] Accepting List of buckets and categories Ids rather than as payload --- .../Controllers/DirectoryController.cs | 13 ++++++++---- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 2e6db54..ba05625 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,14 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) + public async Task GetContactList([FromQuery] string? search, [FromQuery] List? bucketIds, [FromQuery] List? categoryIds, [FromQuery] Guid? projectId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); + ContactFilterDto filterDto = new ContactFilterDto + { + BucketIds = bucketIds, + CategoryIds = categoryIds + }; + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto, projectId); if (response.StatusCode == 200) @@ -164,9 +169,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet("note/{ContactId}")] - public async Task GetNoteListByContactId(Guid contactId) + public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetNoteListByContactId(contactId); + var response = await _directoryHelper.GetNoteListByContactId(contactId, active); if (response.StatusCode == 200) { return Ok(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index dc82f01..43f0b7b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -29,20 +29,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto, Guid? projectId) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { - bucketIds = filterDto.BucketIds; + filterbucketIds = filterDto.BucketIds; } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + List contactIds = contactBuckets.Where(b => filterbucketIds.Contains(b.BucketId)).Select(cb => cb.ContactId).ToList(); List contacts = new List(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + if (projectId != null && projectId != Guid.Empty) + { + contactProjects = contactProjects.Where(p => p.ProjectId == projectId).ToList(); + contactIds = contactProjects.Select(p => p.ContactId).Distinct().ToList(); + } + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) { var categoryIds = filterDto.CategoryIds; @@ -56,7 +65,6 @@ namespace Marco.Pms.Services.Helpers var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); List TagIds = Tags.Select(t => t.ContactTagId).ToList(); @@ -809,14 +817,14 @@ namespace Marco.Pms.Services.Helpers // -------------------------------- Contact Notes -------------------------------- - public async Task> GetNoteListByContactId(Guid id) + public async Task> GetNoteListByContactId(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { -- 2.43.0 From a14bbb06a6a81533c2f21f2919755df421d9160b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 19:48:45 +0530 Subject: [PATCH 078/469] Implemented an API to update Buckets for grouping contacts. --- .../Dtos/Directory/UpdateBucketDto.cs | 9 ++++++ .../Controllers/DirectoryController.cs | 18 +++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 31 ++++++++++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs new file mode 100644 index 0000000..4428941 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateBucketDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index ba05625..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -247,5 +247,23 @@ namespace Marco.Pms.Services.Controllers } } + + [HttpPut("bucket/{id}")] + public async Task UpdateBucket(Guid id, [FromBody] UpdateBucketDto bucketDto) + { + var response = await _directoryHelper.UpdateBucket(id, bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 43f0b7b..764776d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -941,7 +941,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } - public async Task> CreateBucket(CreateBucketDto bucketDto) { Guid tenantId = _userHelper.GetTenantId(); @@ -978,7 +977,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateBucket(Guid id, UpdateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null && id == bucketDto.Id) + { + var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + bucket.Name = bucketDto.Name ?? ""; + bucket.Description = bucketDto.Description ?? ""; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketDto.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 7c09cf49e1f814e47590be5a721f07716789e42a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 20:27:13 +0530 Subject: [PATCH 079/469] Implemented an API to update Contact Category Master --- .../Controllers/MasterController.cs | 55 +++++++--------- Marco.Pms.Services/Helpers/MasterHelper.cs | 65 +++++++++++++++++++ 2 files changed, 89 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index dc4cd61..3512081 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,8 +1,6 @@ using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -717,11 +715,22 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } - [HttpPost("contact-category/edit/{id}")] public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) { - return Ok(); + var response = await _masterHelper.UpdateContactCategory(id, updateContactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("contact-category/{id}")] @@ -776,36 +785,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag/edit/{id}")] public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) { - - var tenantId = _userHelper.GetTenantId(); - Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContactTagDto != null && updateContactTagDto.Id != id) + var response = await _masterHelper.UpdateContactTag(id, updateContactTagDto); + if (response.StatusCode == 200) { - ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); - if (contactTag != null) - { - contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); - _context.ContactTagMasters.Update(contactTag); - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contactTag.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - - ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); - - - - _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); - return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); - } + return Ok(response); } - _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); - return NotFound(ApiResponse.ErrorResponse("Contact Tag master not found", "Work category master not found", 404)); + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("contact-tag/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 4d29908..55883f6 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,6 +1,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Master; @@ -47,6 +48,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContactCategory(Guid id, UpdateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null && id == contactCategoryDto.Id) + { + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Id == id); + if (contactCategory != null) + { + contactCategory.Name = contactCategoryDto.Name ?? ""; + contactCategory.Description = contactCategoryDto.Description ?? ""; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactCategory.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a contact category but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -154,6 +186,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContactTag(Guid id, UpdateContactTagDto contactTagDto) + { + var tenantId = _userHelper.GetTenantId(); + Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null && contactTagDto.Id != id) + { + ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == contactTagDto.Id); + if (contactTag != null) + { + contactTag = contactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); + _context.ContactTagMasters.Update(contactTag); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactTag.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + + ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); + + + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully by employee {EmployeeId}", contactTagVm.Id, LoggedInEmployee.Id); + ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200); + } + _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); + ApiResponse.ErrorResponse("Contact Tag master not found", "Contact tag master not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> DeleteContactTag(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 71aee738f427bdbcdf646361258760068d034629 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 24 May 2025 15:45:43 +0530 Subject: [PATCH 080/469] Add Directory Management Feature with Permission Handling --- .../Data/ApplicationDbContext.cs | 17 +- ...d_Feature_Directory_Management.Designer.cs | 3055 +++++++++++++++++ ...4333_Added_Feature_Directory_Management.cs | 100 + .../ApplicationDbContextModelSnapshot.cs | 48 + Marco.Pms.Model/Directory/Bucket.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 + .../appsettings.Development.json | 3 +- 7 files changed, 3220 insertions(+), 11 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 13cd596..14fab8c 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -496,17 +496,15 @@ namespace Marco.Pms.DataAccess.Data modelBuilder.Entity().HasData( new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Manage Project", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, new Feature { Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), Description = "Manage Infra", Name = "Manage Infra", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, - new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Task Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), 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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, - - new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Employee Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true }, new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true }, - new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } - //new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } + new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }, + new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Managing all directory related rights", Name = "Directory Management", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } + + //new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } ); modelBuilder.Entity().HasData( @@ -533,8 +531,11 @@ namespace Marco.Pms.DataAccess.Data new FeaturePermission { Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Regularize Attendance", Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records" }, new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency" }, - new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" } - //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("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" }, + + new FeaturePermission { Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Admin", Description = "Full control over all directories, including the ability to manage permissions for all directories in the system." }, + new FeaturePermission { Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Manager", Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories." }, + new FeaturePermission { Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory User", Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created." } //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/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs new file mode 100644 index 0000000..6e2f931 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs @@ -0,0 +1,3055 @@ +// +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("20250524074333_Added_Feature_Directory_Management")] + partial class Added_Feature_Directory_Management + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedByID"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Grants a user the ability to record their own work hours or presence within the system. This typically involves checking in and checking out, logging break times, and potentially viewing their own attendance history.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" + }); + }); + + 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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs new file mode 100644 index 0000000..1319786 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs @@ -0,0 +1,100 @@ +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 Added_Feature_Directory_Management : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CreatedAt", + table: "Buckets", + type: "datetime(6)", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "CreatedByID", + table: "Buckets", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.InsertData( + table: "Features", + columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" }, + values: new object[] { new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Managing all directory related rights", true, new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), "Directory Management" }); + + migrationBuilder.InsertData( + table: "FeaturePermissions", + columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" }, + values: new object[,] + { + { new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory User" }, + { new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), "Full control over all directories, including the ability to manage permissions for all directories in the system.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Admin" }, + { new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Manager" } + }); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_CreatedByID", + table: "Buckets", + column: "CreatedByID"); + + migrationBuilder.AddForeignKey( + name: "FK_Buckets_Employees_CreatedByID", + table: "Buckets", + column: "CreatedByID", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Buckets_Employees_CreatedByID", + table: "Buckets"); + + migrationBuilder.DropIndex( + name: "IX_Buckets_CreatedByID", + table: "Buckets"); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("0f919170-92d4-4337-abd3-49b66fc871bb")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("62668630-13ce-4f52-a0f0-db38af2230c5")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606")); + + migrationBuilder.DropColumn( + name: "CreatedAt", + table: "Buckets"); + + migrationBuilder.DropColumn( + name: "CreatedByID", + table: "Buckets"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index bbd22d7..7064d93 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -269,6 +269,12 @@ namespace Marco.Pms.DataAccess.Migrations .ValueGeneratedOnAdd() .HasColumnType("char(36)"); + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + b.Property("Description") .IsRequired() .HasColumnType("longtext"); @@ -282,6 +288,8 @@ namespace Marco.Pms.DataAccess.Migrations b.HasKey("Id"); + b.HasIndex("CreatedByID"); + b.HasIndex("TenantId"); b.ToTable("Buckets"); @@ -961,6 +969,30 @@ namespace Marco.Pms.DataAccess.Migrations FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" }); }); @@ -1305,6 +1337,14 @@ namespace Marco.Pms.DataAccess.Migrations IsActive = true, ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" }); }); @@ -2357,12 +2397,20 @@ namespace Marco.Pms.DataAccess.Migrations modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("CreatedBy"); + b.Navigation("Tenant"); }); diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs index 028b428..0d382c5 100644 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -1,4 +1,5 @@ -using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; namespace Marco.Pms.Model.Directory { @@ -6,6 +7,9 @@ namespace Marco.Pms.Model.Directory { public Guid Id { get; set; } public string Name { get; set; } = string.Empty; + public Guid CreatedByID { get; set; } + public Employee? CreatedBy { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 764776d..370e8fd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -957,6 +957,8 @@ namespace Marco.Pms.Services.Helpers { Name = bucketDto.Name, Description = bucketDto.Description, + CreatedAt = DateTime.UtcNow, + CreatedByID = LoggedInEmployee.Id, TenantId = tenantId }; _context.Buckets.Add(bucket); diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json index 1522ad9..e8a8e8c 100644 --- a/Marco.Pms.Services/appsettings.Development.json +++ b/Marco.Pms.Services/appsettings.Development.json @@ -11,8 +11,7 @@ "AllowedHeaders": "*" }, "ConnectionStrings": { - //"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2" - "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSDev" + "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSGuid" }, "MongoDB": { "SerilogDatabaseUrl": "mongodb://localhost:27017/DotNetLogs" -- 2.43.0 From b05c3509ad9c86f254e1577d19bc1ff9e6e7c68a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 081/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From ad4b618bee596831eaafd6c50c404f4760dee624 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 09:51:01 +0000 Subject: [PATCH 082/469] revert c7e89630eb494454c1322bdf4cf29ab076af7b86 revert Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 -- Marco.Pms.Model/Directory/Contact.cs | 31 --- .../Directory/ContactBucketMapping.cs | 18 -- .../Directory/ContactCategoryMaster.cs | 11 -- Marco.Pms.Model/Directory/ContactEmail.cs | 21 --- Marco.Pms.Model/Directory/ContactNote.cs | 25 --- Marco.Pms.Model/Directory/ContactPhone.cs | 22 --- .../Directory/ContactTagMapping.cs | 11 -- Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 -- .../Directory/DirectoryUpdateLog.cs | 18 -- .../Directory/EmployeeBucketMapping.cs | 19 -- .../Dtos/Directory/CreateBucketDto.cs | 8 - .../Dtos/Directory/CreateContactDto.cs | 15 -- .../Dtos/Directory/CreateContactEmailDto.cs | 9 - .../Dtos/Directory/CreateContactNoteDto.cs | 8 - .../Dtos/Directory/CreateContactPhoneDto.cs | 9 - .../Dtos/Directory/UpdateContactDto.cs | 16 -- .../Dtos/Directory/UpdateContactEmailDto.cs | 10 - .../Dtos/Directory/UpdateContactNoteDto.cs | 9 - .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 - .../Dtos/Master/CreateContactCategoryDto.cs | 8 - .../Dtos/Master/CreateContactTagDto.cs | 7 - .../Dtos/Master/UpdateContactCategoryDto.cs | 9 - .../Dtos/Master/UpdateContactTagDto.cs | 8 - Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ------------------ .../ViewModels/Directory/ContactEmailVM.cs | 10 - .../ViewModels/Directory/ContactPhoneVM.cs | 10 - .../ViewModels/Directory/ContactVM.cs | 18 -- .../ViewModels/Master/ContactCategoryVM.cs | 9 - .../ViewModels/Master/ContactTagVM.cs | 8 - 30 files changed, 556 deletions(-) delete mode 100644 Marco.Pms.Model/Directory/Bucket.cs delete mode 100644 Marco.Pms.Model/Directory/Contact.cs delete mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs delete mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs delete mode 100644 Marco.Pms.Model/Directory/ContactNote.cs delete mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs delete mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs delete mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs deleted file mode 100644 index 028b428..0000000 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class Bucket : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs deleted file mode 100644 index 87d7698..0000000 --- a/Marco.Pms.Model/Directory/Contact.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class Contact : TenantRelation - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - public string Organization { get; set; } = string.Empty; - public string? Address { get; set; } - public bool IsActive { get; set; } = true; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - - [DisplayName("ContactCategoryId")] - public Guid? ContactCategoryId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactCategoryId))] - public ContactCategoryMaster? ContactCategory { get; set; } - public DateTime CreatedAt { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs deleted file mode 100644 index 9444337..0000000 --- a/Marco.Pms.Model/Directory/ContactBucketMapping.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs deleted file mode 100644 index 8fb1a94..0000000 --- a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactCategoryMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs deleted file mode 100644 index 1eb1b34..0000000 --- a/Marco.Pms.Model/Directory/ContactEmail.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactEmail - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string EmailAddress { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs deleted file mode 100644 index e203f1d..0000000 --- a/Marco.Pms.Model/Directory/ContactNote.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactNote : TenantRelation - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? Createdby { get; set; } - public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - public Guid ContactId { get; set; } - - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs deleted file mode 100644 index d10439b..0000000 --- a/Marco.Pms.Model/Directory/ContactPhone.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactPhone - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string PhoneNumber { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs deleted file mode 100644 index a3d7e9e..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMapping - { - public Guid Id { get; set; } - public Guid ContactId { get; set; } - public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } - public ContactTagMaster? ContactTag { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs deleted file mode 100644 index 86eba76..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs deleted file mode 100644 index 91b1b7a..0000000 --- a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class DirectoryUpdateLog - { - public Guid Id { get; set; } - public Guid RefereanceId { get; set; } - public DateTime UpdateAt { get; set; } = DateTime.UtcNow; - public Guid UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs deleted file mode 100644 index db12d3f..0000000 --- a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class EmployeeBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid EmployeeId { get; set; } - [ValidateNever] - [ForeignKey("EmployeeId")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs deleted file mode 100644 index ba0918d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateBucketDto - { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs deleted file mode 100644 index 42937c0..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactDto - { - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs deleted file mode 100644 index 68bb2b2..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactEmailDto - { - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs deleted file mode 100644 index 1ccaea9..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactNoteDto - { - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs deleted file mode 100644 index dc97881..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactPhoneDto - { - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs deleted file mode 100644 index 042150d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactDto - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs deleted file mode 100644 index 8ece036..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactEmailDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs deleted file mode 100644 index 295357a..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactNoteDto - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs deleted file mode 100644 index 1ddfb14..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactPhoneDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs deleted file mode 100644 index 3efc443..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactCategoryDto - { - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs deleted file mode 100644 index ad91ca7..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactTagDto - { - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs deleted file mode 100644 index 0bd5cc7..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactCategoryDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs deleted file mode 100644 index 0406a6c..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactTagDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs deleted file mode 100644 index 048a0d2..0000000 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ /dev/null @@ -1,177 +0,0 @@ -using Marco.Pms.Model.Directory; -using Marco.Pms.Model.Dtos.Directory; -using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.ViewModels.Directory; -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.Mapper -{ - public static class DirectoryMapper - { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) - { - - return new Contact - { - ProjectId = createContactDto.ProjectId, - Name = createContactDto.Name ?? string.Empty, - ContactCategoryId = createContactDto.ContactCategoryId, - Description = createContactDto.Description ?? string.Empty, - Organization = createContactDto?.Organization ?? string.Empty, - Address = createContactDto != null ? createContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) - { - - return new Contact - { - Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, - Name = updateContactDto.Name ?? string.Empty, - ContactCategoryId = updateContactDto.ContactCategoryId, - Description = updateContactDto.Description ?? string.Empty, - Organization = updateContactDto?.Organization ?? string.Empty, - Address = updateContactDto != null ? updateContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static ContactVM ToContactVMFromContact(this Contact contact) - { - return new ContactVM - { - Id = contact.Id, - ProjectId = contact.ProjectId, - Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), - Description = contact.Description ?? string.Empty, - Organization = contact.Organization ?? string.Empty, - Address = contact.Address ?? string.Empty - }; - } - - //Contact Phone Mapper - public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Label = createContactPhoneDto.Label ?? string.Empty, - PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Id = updateContactPhoneDto.Id, - Label = updateContactPhoneDto.Label ?? string.Empty, - PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) - { - return new ContactPhoneVM - { - Id = phone.Id, - Label = phone.Label ?? string.Empty, - PhoneNumber = phone.PhoneNumber ?? string.Empty, - ContactId = phone.ContactId - }; - } - - //Contact Email Mapper - public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Label = createContactEmailDto.Label ?? string.Empty, - EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Id = updateContactEmailDto.Id, - Label = updateContactEmailDto.Label ?? string.Empty, - EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) - { - return new ContactEmailVM - { - Id = email.Id, - Label = email.Label ?? string.Empty, - EmailAddress = email.EmailAddress ?? string.Empty, - ContactId = email.ContactId - }; - } - - //Contact Tag Mapper - public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Name = createContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Id = updateContactTagDto.Id, - Name = updateContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) - { - return new ContactTagVM - { - Id = contactTag.Id, - Name = contactTag.Name ?? string.Empty, - }; - } - - //Contact Category Mapper - public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Name = createContactTypeDto.Name ?? string.Empty, - Description = createContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Id = updateContactTypeDto.Id, - Name = updateContactTypeDto.Name ?? string.Empty, - Description = updateContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) - { - return new ContactCategoryVM - { - Id = contactType.Id, - Name = contactType.Name ?? string.Empty, - Description = contactType.Description ?? string.Empty, - }; - } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs deleted file mode 100644 index 476e44d..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactEmailVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs deleted file mode 100644 index 1dc7672..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactPhoneVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs deleted file mode 100644 index 6d6f82e..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactVM - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? Tags { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs deleted file mode 100644 index eb08d89..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactCategoryVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs deleted file mode 100644 index 2cb6f8a..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactTagVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} -- 2.43.0 From f30ae5ed5c0d089c122085f279113bc2d841385c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:27:36 +0530 Subject: [PATCH 083/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From 000cf74c1fc51c0757509a70f4521e4894f8a58c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:38:47 +0530 Subject: [PATCH 084/469] Added Directory controller file --- Marco.Pms.Services/Controllers/DirectoryController.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Marco.Pms.Services/Controllers/DirectoryController.cs diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs new file mode 100644 index 0000000..77a183c --- /dev/null +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Marco.Pms.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class DirectoryController : ControllerBase + { + } +} -- 2.43.0 From 1fccbb4e3a7adcbcff0becb157ca07b61257fd7c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:44:30 +0530 Subject: [PATCH 085/469] An API skeleton has been added. --- .../Controllers/DirectoryController.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 77a183c..b0de798 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,4 +1,8 @@ -using Microsoft.AspNetCore.Mvc; +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Dtos.Directory; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { @@ -6,5 +10,32 @@ namespace Marco.Pms.Services.Controllers [ApiController] public class DirectoryController : ControllerBase { + + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + + [HttpGet] + public async Task GetContactList() + { + return Ok(); + } + + [HttpPost] + public async Task CreateContact([FromBody] CreateContactDto createContact) + { + return Ok(); + } + { + return Ok(); } } +} -- 2.43.0 From 0f70263ecb2f6387defd4257460738ff0a75a1f0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 16:10:07 +0530 Subject: [PATCH 086/469] Added Migration for contact related tables --- .../Data/ApplicationDbContext.cs | 13 + ...Added_Directory_Related_Tables.Designer.cs | 2990 +++++++++++++++++ ...14103249_Added_Directory_Related_Tables.cs | 440 +++ .../ApplicationDbContextModelSnapshot.cs | 479 +++ Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- 5 files changed, 3923 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index db9492d..54fd3c3 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -2,6 +2,7 @@ using Marco.Pms.Model.Activities; using Marco.Pms.Model.AttendanceModule; using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.DocumentManager; using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; @@ -89,6 +90,18 @@ namespace Marco.Pms.DataAccess.Data public DbSet Documents { get; set; } public DbSet TicketTags { get; set; } public DbSet WorkCategoryMasters { get; set; } + public DbSet Contacts { get; set; } + public DbSet ContactCategoryMasters { get; set; } + public DbSet ContactsEmails { get; set; } + public DbSet ContactsPhones { get; set; } + public DbSet ContactNotes { get; set; } + public DbSet Buckets { get; set; } + public DbSet ContactTagMasters { get; set; } + public DbSet ContactTagMappings { get; set; } + public DbSet EmployeeBucketMappings { get; set; } + public DbSet ContactBucketMappings { get; set; } + public DbSet DirectoryUpdateLogs { get; set; } + protected override void OnModelCreating(ModelBuilder modelBuilder) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs new file mode 100644 index 0000000..f50346e --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -0,0 +1,2990 @@ +// +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("20250514103249_Added_Directory_Related_Tables")] + partial class Added_Directory_Related_Tables + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs new file mode 100644 index 0000000..879f54b --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -0,0 +1,440 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_Directory_Related_Tables : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Buckets", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Buckets", x => x.Id); + table.ForeignKey( + name: "FK_Buckets_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactCategoryMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactCategoryMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactCategoryMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "DirectoryUpdateLogs", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + RefereanceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + UpdateAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_DirectoryUpdateLogs", x => x.Id); + table.ForeignKey( + name: "FK_DirectoryUpdateLogs_Employees_UpdatedById", + column: x => x.UpdatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "EmployeeBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_EmployeeBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Contacts", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: true, 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"), + Organization = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Address = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactCategoryId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Contacts", x => x.Id); + table.ForeignKey( + name: "FK_Contacts_ContactCategoryMasters_ContactCategoryId", + column: x => x.ContactCategoryId, + principalTable: "ContactCategoryMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Contacts_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contacts_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactBucketMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactNotes", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactNotes", x => x.Id); + table.ForeignKey( + name: "FK_ContactNotes_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsEmails", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmailAddress = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsEmails", x => x.Id); + table.ForeignKey( + name: "FK_ContactsEmails_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsPhones", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsPhones", x => x.Id); + table.ForeignKey( + name: "FK_ContactsPhones_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + column: x => x.ContactTagId, + principalTable: "ContactTagMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ContactTagMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_TenantId", + table: "Buckets", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_BucketId", + table: "ContactBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_ContactId", + table: "ContactBucketMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactCategoryMasters_TenantId", + table: "ContactCategoryMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_ContactId", + table: "ContactNotes", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_CreatedById", + table: "ContactNotes", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_TenantId", + table: "ContactNotes", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_ContactCategoryId", + table: "Contacts", + column: "ContactCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_CreatedById", + table: "Contacts", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_TenantId", + table: "Contacts", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsEmails_ContactId", + table: "ContactsEmails", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsPhones_ContactId", + table: "ContactsPhones", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactId", + table: "ContactTagMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMasters_TenantId", + table: "ContactTagMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DirectoryUpdateLogs_UpdatedById", + table: "DirectoryUpdateLogs", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_BucketId", + table: "EmployeeBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_EmployeeId", + table: "EmployeeBucketMappings", + column: "EmployeeId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactNotes"); + + migrationBuilder.DropTable( + name: "ContactsEmails"); + + migrationBuilder.DropTable( + name: "ContactsPhones"); + + migrationBuilder.DropTable( + name: "ContactTagMappings"); + + migrationBuilder.DropTable( + name: "DirectoryUpdateLogs"); + + migrationBuilder.DropTable( + name: "EmployeeBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactTagMasters"); + + migrationBuilder.DropTable( + name: "Contacts"); + + migrationBuilder.DropTable( + name: "Buckets"); + + migrationBuilder.DropTable( + name: "ContactCategoryMasters"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 75816f0..ddf9c0c 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -263,6 +263,312 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("RefreshTokens"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.Property("Id") @@ -2029,6 +2335,179 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("User"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 048a0d2..d66615a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty -- 2.43.0 From 57dbfab32f7ef0263b395307a3c36c3a96516e6a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 17:51:57 +0530 Subject: [PATCH 087/469] Added DirectoryHelper in helper folder --- .../Dtos/Directory/CreateContactDto.cs | 3 +- .../Dtos/Directory/UpdateContactDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 ++- .../Controllers/DirectoryController.cs | 34 ++++++++++++------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 21 ++++++++++++ Marco.Pms.Services/Program.cs | 2 ++ 6 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 Marco.Pms.Services/Helpers/DirectoryHelper.cs diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 42937c0..6e962a4 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -6,7 +6,8 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } + public List? BucketIds { get; set; } + public Guid? ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 042150d..7c93cce 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -7,6 +7,7 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } + public List? BucketIds { get; set; } public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index d66615a..abf72d3 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -8,7 +8,7 @@ namespace Marco.Pms.Model.Mapper { public static class DirectoryMapper { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId, Guid employeeId) { return new Contact @@ -19,6 +19,8 @@ namespace Marco.Pms.Model.Mapper Description = createContactDto.Description ?? string.Empty, Organization = createContactDto?.Organization ?? string.Empty, Address = createContactDto != null ? createContactDto.Address : string.Empty, + CreatedById = employeeId, + CreatedAt = DateTime.UtcNow, TenantId = tenantId }; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b0de798..a2f984c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,26 +1,25 @@ -using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Dtos.Directory; -using MarcoBMS.Services.Helpers; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { - [Route("api/[controller]")] [ApiController] + [Route("api/[controller]")] + public class DirectoryController : ControllerBase { - private readonly ApplicationDbContext _context; + private readonly DirectoryHelper _directoryHelper; private readonly ILoggingService _logger; - private readonly UserHelper _userHelper; - public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + public DirectoryController(DirectoryHelper directoryHelper, ILoggingService logger) { - _context = context; + _directoryHelper = directoryHelper; _logger = logger; - _userHelper = userHelper; } [HttpGet] @@ -32,10 +31,21 @@ namespace Marco.Pms.Services.Controllers [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + return Ok(); } - { - return Ok(); + + + + } } -} diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs new file mode 100644 index 0000000..832d190 --- /dev/null +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -0,0 +1,21 @@ +using Marco.Pms.DataAccess.Data; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; + +namespace Marco.Pms.Services.Helpers +{ + public class DirectoryHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index ff4cca8..86eb297 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -3,6 +3,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Authentication; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using Marco.Pms.Services.Service; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Middleware; @@ -130,6 +131,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From 172aab1b017f22b8ea1e2d1b3219157378f38712 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 088/469] created GetListOfContact custome function --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../ViewModels/Directory/ContactVM.cs | 2 +- .../Controllers/DirectoryController.cs | 13 ++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 92 ++++++++++++++++++- 4 files changed, 105 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index abf72d3..fbe0e46 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index 6d6f82e..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.ViewModels.Directory public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a2f984c..efa76c3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,7 +25,18 @@ namespace Marco.Pms.Services.Controllers [HttpGet] public async Task GetContactList() { - return Ok(); + var response = await _directoryHelper.GetListOfContacts(); + + + if(response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 832d190..5e11587 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,6 +1,12 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; namespace Marco.Pms.Services.Helpers { @@ -17,5 +23,89 @@ namespace Marco.Pms.Services.Helpers _logger = logger; _userHelper = userHelper; } + + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + + List contactIds = contacts.Select(c=>c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); + + var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); + + + List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if(emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if(phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + + if (tagMappingss != null) { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag.ToContactTagVMFromContactTagMaster(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + + return ApiResponse.SuccessResponse(list, "Contact List !",200); + + } } -} + } -- 2.43.0 From c95a666c31ad9ea385066ab75e8aaec090fd7685 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 089/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 2 +- .../Dtos/Directory/CreateContactPhoneDto.cs | 1 - .../Controllers/DirectoryController.cs | 11 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 110 ++++++++++++++++++ 4 files changed, 120 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 68bb2b2..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,6 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } } } + diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index dc97881..a72ac3d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,6 +4,5 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index efa76c3..afcb061 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -51,8 +51,15 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("User sent Invalid Date while marking attendance"); return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); } - - return Ok(); + var response = await _directoryHelper.CreateContact(createContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5e11587..b1f6e9c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,5 +1,6 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; @@ -107,5 +108,114 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, "Contact List !",200); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } -- 2.43.0 From 3e4f29b18687f48a94a8699a121e1cb6dff48d4b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 090/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 84 ------------------- 1 file changed, 84 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b1f6e9c..7ac80c4 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -25,90 +25,6 @@ namespace Marco.Pms.Services.Helpers _userHelper = userHelper; } - - - public async Task> GetListOfContacts() - { - Guid tenantId = _userHelper.GetTenantId(); - - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - - List contactIds = contacts.Select(c=>c.Id).ToList(); - - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - - var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); - - var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); - - - List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); - - var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); - - List list = new List(); - - foreach (var contact in contacts) - { - - ContactVM contactVM = new ContactVM(); - List contactEmailVms = new List(); - List contactPhoneVms = new List(); - - List conatctTagVms = new List(); - var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); - var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); - var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - - - if(emails != null) - { - foreach (var email in emails) - { - ContactEmailVM emailVM = new ContactEmailVM(); - emailVM = email.ToContactEmailVMFromContactEmail(); - contactEmailVms.Add(emailVM); - } - } - - if(phones != null) - { - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = new ContactPhoneVM(); - phoneVM = phone.ToContactPhoneVMFromContactPhone(); - contactPhoneVms.Add(phoneVM); - } - - } - - if (tagMappingss != null) { - foreach (var tagMapping in tagMappingss) - { - ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); - - tagVM = tag.ToContactTagVMFromContactTagMaster(); - conatctTagVms.Add(tagVM); - - - } - } - - - contactVM = contact.ToContactVMFromContact(); - - contactVM.ContactEmails = contactEmailVms; - contactVM.ContactPhones = contactPhoneVms; - contactVM.Tags = conatctTagVms; - - list.Add(contactVM); - } - - return ApiResponse.SuccessResponse(list, "Contact List !",200); - - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 94434e80681ee7e39a5b4bbdf6a43744131a8c40 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 091/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../Controllers/DirectoryController.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 81 ++++++++++++++++++- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index fbe0e46..b9e9f86 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index afcb061..b5ac7e5 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -2,12 +2,14 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { [ApiController] [Route("api/[controller]")] + [Authorize] public class DirectoryController : ControllerBase { @@ -28,7 +30,7 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetListOfContacts(); - if(response.StatusCode == 200) + if (response.StatusCode == 200) { return Ok(response); } @@ -36,7 +38,7 @@ namespace Marco.Pms.Services.Controllers { return BadRequest(response); } - + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 7ac80c4..c34d2ac 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -25,6 +25,85 @@ namespace Marco.Pms.Services.Helpers _userHelper = userHelper; } + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); + var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if (emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if (phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + if (tagMappingss != null) + { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + _logger.LogInfo("{count} contacts are fetched by Employee with ID {LoggedInEmployeeId}", list.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); + + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -134,4 +213,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From cf9f6ce5a3d5148417093bcdd826c431e3dcae16 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 12:51:23 +0530 Subject: [PATCH 092/469] Created an API to create the Contact category --- .../Dtos/Master/CreateContactTagDto.cs | 1 + .../Dtos/Master/UpdateContactTagDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Master/ContactTagVM.cs | 1 + .../Controllers/MasterController.cs | 81 ++++++++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 54 +++++++++++++ Marco.Pms.Services/Program.cs | 1 + 7 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Services/Helpers/MasterHelper.cs diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs index ad91ca7..2fec4ae 100644 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -3,5 +3,6 @@ public class CreateContactTagDto { public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs index 0406a6c..e97ece6 100644 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b9e9f86..82e703f 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -125,6 +125,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagMaster { Name = createContactTagDto.Name ?? string.Empty, + Description = createContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -134,6 +135,7 @@ namespace Marco.Pms.Model.Mapper { Id = updateContactTagDto.Id, Name = updateContactTagDto.Name ?? string.Empty, + Description = updateContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -142,6 +144,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagVM { Id = contactTag.Id, + Description = contactTag.Description ?? string.Empty, Name = contactTag.Name ?? string.Empty, }; } diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs index 2cb6f8a..321b669 100644 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index b89dc91..0d0221b 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -9,6 +9,7 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Activities; using Marco.Pms.Model.ViewModels.Forum; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Authorization; @@ -25,11 +26,13 @@ namespace Marco.Pms.Services.Controllers private readonly ApplicationDbContext _context; private readonly UserHelper _userHelper; private readonly ILoggingService _logger; - public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger) + private readonly MasterHelper _masterHelper; + public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger, MasterHelper masterHelper) { _context = context; _userHelper = userHelper; _logger = logger; + _masterHelper = masterHelper; } // -------------------------------- Activity -------------------------------- @@ -667,5 +670,81 @@ namespace Marco.Pms.Services.Controllers return NotFound(ApiResponse.ErrorResponse("Work category not found", "Work category not found", 404)); } } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-categories")] + public async Task GetContactCategoryMasterList() + { + return Ok(); + } + + [HttpGet("contact-category/{id})")] + public async Task GetContactCategoryMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-category")] + public async Task CreateContactCategoryMaster([FromBody] CreateContactCategoryDto contactCategoryDto) + { + var response = await _masterHelper.CreateContactCategory(contactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPost("contact-category/edit/{id}")] + public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) + { + return Ok(); + } + + [HttpDelete("contact-category/{id}")] + public async Task DeletecontactCategoryMaster(Guid id) + { + return Ok(); + } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-tags")] + public async Task GetContactTagMasterList() + { + return Ok(); + } + + [HttpGet("contact-tag/{id})")] + public async Task GetContactTagMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-tag")] + public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) + { + return Ok(); + } + + [HttpPost("contact-tag/edit/{id}")] + public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) + { + return Ok(); + } + + [HttpDelete("contact-tag/{id}")] + public async Task DeletecontactTagMaster(Guid id) + { + return Ok(); + } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs new file mode 100644 index 0000000..893eee2 --- /dev/null +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -0,0 +1,54 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Master; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; + +namespace Marco.Pms.Services.Helpers +{ + public class MasterHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public MasterHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + // -------------------------------- Contact Category -------------------------------- + public async Task> CreateContactCategory(CreateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactCategoryDto.Name != null ? contactCategoryDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactCategoryMaster contactCategory = contactCategoryDto.ToContactCategoryMasterFromCreateContactCategoryDto(tenantId); + _context.ContactCategoryMasters.Add(contactCategory); + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact category.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category already existed", "Category already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + // -------------------------------- Contact Tag -------------------------------- + // -------------------------------- Bucket -------------------------------- + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index 86eb297..d8adc25 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -132,6 +132,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From b4505827bbd7fc68ba9b7f640c1b6dac5e113c34 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 093/469] Created an endpoint to fetch list of all contact category in that tenant --- .../Controllers/MasterController.cs | 5 +++-- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 0d0221b..fe0f1e9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -676,7 +676,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-categories")] public async Task GetContactCategoryMasterList() { - return Ok(); + var response = await _masterHelper.GetContactCategoriesList(); + return Ok(response); } [HttpGet("contact-category/{id})")] @@ -715,7 +716,7 @@ namespace Marco.Pms.Services.Controllers return Ok(); } - // -------------------------------- Contact Category -------------------------------- + // -------------------------------- Contact Tag -------------------------------- [HttpGet("contact-tags")] public async Task GetContactTagMasterList() diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 893eee2..75c6d5f 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -48,6 +48,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- // -------------------------------- Bucket -------------------------------- } -- 2.43.0 From 0809d265174f1385e776077544fb984d0408fc54 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 094/469] Added an API to update existing contact --- .../Dtos/Directory/ContactTagDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactEmailDto.cs | 2 +- .../Dtos/Directory/UpdateContactPhoneDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +- .../Controllers/DirectoryController.cs | 18 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 8 files changed, 258 insertions(+), 13 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs new file mode 100644 index 0000000..12b0223 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactTagDto + { + public Guid? Id { get; set; } + public string Name { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 6e962a4..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -11,6 +11,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 7c93cce..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -12,6 +12,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs index 8ece036..186f5b3 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactEmailDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? EmailAddress { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs index 1ddfb14..ff0ec23 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactPhoneDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? PhoneNumber { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 82e703f..9b5c835 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -68,7 +68,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactPhone { - Id = updateContactPhoneDto.Id, + Id = updateContactPhoneDto.Id ?? Guid.Empty, Label = updateContactPhoneDto.Label ?? string.Empty, PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, ContactId = contactId, @@ -101,7 +101,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactEmail { - Id = updateContactEmailDto.Id, + Id = updateContactEmailDto.Id ?? Guid.Empty, Label = updateContactEmailDto.Label ?? string.Empty, EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, ContactId = contactId, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b5ac7e5..fe82bce 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -64,7 +64,23 @@ namespace Marco.Pms.Services.Controllers } } - + [HttpPut("{id}")] + public async Task UpdateContact(Guid id, [FromBody] UpdateContactDto updateContact) + { + var response = await _directoryHelper.UpdateContact(id, updateContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c34d2ac..81f419c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -162,17 +162,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -209,8 +224,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From 1a64879a057851361dadcb71f6db549ca8433835 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 095/469] added api to get list of contact tag --- .../Controllers/MasterController.cs | 3 ++- Marco.Pms.Services/Helpers/MasterHelper.cs | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index fe0f1e9..4df3a62 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -721,7 +721,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-tags")] public async Task GetContactTagMasterList() { - return Ok(); + var response = await _masterHelper.GetContactTags(); + return Ok(response); } [HttpGet("contact-tag/{id})")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 75c6d5f..ca1bbde 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -65,6 +66,23 @@ namespace Marco.Pms.Services.Helpers } // -------------------------------- Contact Tag -------------------------------- + + + public async Task> GetContactTags() + { + Guid tenantId = _userHelper.GetTenantId(); + + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + List contactTags = new List(); + foreach (var tag in taglist) { + ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); + contactTags.Add(tagVm); + } + _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + } // -------------------------------- Bucket -------------------------------- } } -- 2.43.0 From 4d1126b3f8b478196fed0844c74ac77ad3750bee Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 096/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 11 ++++++++++ .../ViewModels/Directory/BucketVM.cs | 9 ++++++++ .../Controllers/DirectoryController.cs | 6 +++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/BucketVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 9b5c835..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -178,5 +178,16 @@ namespace Marco.Pms.Model.Mapper Description = contactType.Description ?? string.Empty, }; } + + // Bucket + public static BucketVM ToBucketVMFromBucket(this Bucket bucket) + { + return new BucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs new file mode 100644 index 0000000..ce9ed9e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class BucketVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fe82bce..65ccd2d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -83,5 +83,11 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("buckets")] + public async Task GetBucketList() + { + var response = await _directoryHelper.GetBucketList(); + return Ok(response); + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 81f419c..5d8e0b7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -433,5 +433,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From 23db7c4861c461614091a8b2c3daa88ef0bd613b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 097/469] Added an API to create a contact tag --- .../Controllers/MasterController.cs | 23 ++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 34 ++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 4df3a62..8e4a86f 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -734,7 +734,28 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag")] public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) { - return Ok(); + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _masterHelper.CreateContactTag(contactTagDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-tag/edit/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ca1bbde..1906ec2 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -76,13 +75,38 @@ namespace Marco.Pms.Services.Helpers var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); List contactTags = new List(); - foreach (var tag in taglist) { + foreach (var tag in taglist) + { ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); contactTags.Add(tagVm); } _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count), 200); } - // -------------------------------- Bucket -------------------------------- + public async Task> CreateContactTag(CreateContactTagDto contactTagDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); + _context.ContactTagMasters.Add(contactTag); + await _context.SaveChangesAsync(); + ContactTagVM tagVM = contactTag.ToContactTagVMFromContactTagMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact tag {ContactTagId}.", LoggedInEmployee.Id, contactTag.Id); + return ApiResponse.SuccessResponse(tagVM, "Tag Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact tag.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Tag already existed", "Tag already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + } } -- 2.43.0 From a0b36b204ef1464042ff97ec8242e48e5d5b46d1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:38:24 +0530 Subject: [PATCH 098/469] Fixed the errorof finding tag in wrong table --- Marco.Pms.Services/Helpers/MasterHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 1906ec2..66d3b45 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -89,8 +89,8 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (contactTagDto != null) { - ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); - if (existingContactCategory == null) + ContactTagMaster? existingContactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactTag == null) { ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); _context.ContactTagMasters.Add(contactTag); -- 2.43.0 From 5c5bf6b9e6f2e75aa66f28ef25c6aaa872ae1894 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 099/469] Added an API to create bucket --- .../Dtos/Directory/CreateBucketDto.cs | 4 +- .../Controllers/DirectoryController.cs | 28 ++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs index ba0918d..0c02457 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -2,7 +2,7 @@ { public class CreateBucketDto { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 65ccd2d..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -89,5 +89,33 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetBucketList(); return Ok(response); } + + [HttpPost("bucket")] + public async Task CreateBucket(CreateBucketDto bucketDto) + { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _directoryHelper.CreateBucket(bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5d8e0b7..704a0d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -455,5 +455,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From 4a33e54ebc67d771fca7855f4595773a17583fb3 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 100/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 704a0d0..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -377,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 7a91db7ac169153b84dd2997f5ce8555e044e2a9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 101/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3415 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 54fd3c3..e305c2e 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -100,6 +100,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index ddf9c0c..329b474 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2450,6 +2473,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..46d0482 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..aa1ef35 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,6 +41,24 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From a005db4150ed76330b0532b89aec7f96d1420573 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 102/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 23 insertions(+), 3415 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index e305c2e..54fd3c3 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -100,7 +100,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 329b474..ddf9c0c 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,6 +320,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -475,32 +478,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2473,33 +2450,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -42,6 +44,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index aa1ef35..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,24 +41,6 @@ namespace Marco.Pms.Services.Controllers } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,19 +31,13 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - - List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -61,10 +55,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -74,7 +67,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -84,7 +77,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -97,17 +90,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -119,102 +104,6 @@ namespace Marco.Pms.Services.Helpers } - public async Task> GetContactsListByBucketId(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); - if (employeeBucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); - } - List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); - List contactVMs = new List(); - if (contactBucket.Count > 0) - { - var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); - List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); - List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); - - List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); - List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - - List tagIds = new List(); - List tagMasters = new List(); - if (tags.Count > 0) - { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); - tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - } - - if (contacts.Count > 0) - { - - - foreach (var contact in contacts) - { - List? emailVMs = new List(); - List? phoneVMs = new List(); - List? tagVMs = new List(); - - List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); - List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); - - List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); - List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); - List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); - - if (contactPhones.Count > 0) - { - foreach (var phone in contactPhones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - } - if (contactEmails.Count > 0) - { - foreach (var email in contactEmails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - } - if (contactTags.Count > 0) - { - foreach (var contactTag in contactTags) - { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); - if (tagMaster != null) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - } - } - ContactVM contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = emailVMs; - contactVM.ContactPhones = phoneVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - contactVMs.Add(contactVM); - } - } - - } - _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -234,8 +123,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -258,7 +145,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -274,29 +160,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -314,8 +179,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -326,20 +190,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -365,8 +221,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -385,7 +239,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -405,9 +259,6 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -495,33 +346,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } - if (updateContact.ProjectIds != null) - { - foreach (var ProjectId in updateContact.ProjectIds) - { - if (!projectIds.Contains(ProjectId)) - { - _context.ContactProjectMappings.Add(new ContactProjectMapping - { - ProjectId = ProjectId, - ContactId = contact.Id - }); - } - } - - foreach (var projectMapping in contactProjects) - { - if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) - { - _context.ContactProjectMappings.Remove(projectMapping); - } - } - } - else if (contactProjects != null) - { - _context.ContactProjectMappings.RemoveRange(contactProjects); - } - if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -540,8 +364,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -554,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -576,10 +399,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -608,9 +427,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 10a68125baa553328f2bc1b143f3dad0bbffbe66 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 103/469] Added an API to delete existing contact category --- .../Controllers/MasterController.cs | 3 +- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 8e4a86f..e782913 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -713,7 +713,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-category/{id}")] public async Task DeletecontactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactCategory(id); + return Ok(response); } // -------------------------------- Contact Tag -------------------------------- diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 66d3b45..33fab6b 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -63,6 +63,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From f560a0207d4721fcd823bcc229afe98a124a0a84 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 104/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...63809_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 17 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3414 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 54fd3c3..13cd596 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -101,6 +101,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } + public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..18a4be6 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517063809_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index ddf9c0c..329b474 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2450,6 +2473,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..bd49e18 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -40,6 +40,23 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 9d8ab763889e43f5ce5a961492d9dbe1ac6445ff Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:28:54 +0530 Subject: [PATCH 105/469] Refetched the contact in update contact API --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..ff3f730 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -393,6 +393,7 @@ namespace Marco.Pms.Services.Helpers } var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + _context.Contacts.Update(newContact); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -573,6 +574,7 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 871493bf61a20da9e47d675fcf5e6100a0ad4d22 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 106/469] properly mapped the updated Dto to contact table --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..f78c260 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -23,7 +23,7 @@ namespace Marco.Pms.Model.Mapper TenantId = tenantId }; } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId, Contact contact) { return new Contact @@ -31,6 +31,8 @@ namespace Marco.Pms.Model.Mapper Id = updateContactDto.Id, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, + CreatedAt = contact.CreatedAt, + CreatedById = contact.CreatedById, Description = updateContactDto.Description ?? string.Empty, Organization = updateContactDto?.Organization ?? string.Empty, Address = updateContactDto != null ? updateContactDto.Address : string.Empty, diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ff3f730..f1100c6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -385,15 +385,16 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.AsNoTracking().FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); + await _context.SaveChangesAsync(); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -505,7 +506,8 @@ namespace Marco.Pms.Services.Helpers _context.ContactProjectMappings.Add(new ContactProjectMapping { ProjectId = ProjectId, - ContactId = contact.Id + ContactId = contact.Id, + TenantId = tenantId }); } } @@ -572,7 +574,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From e76c203614897b7cd1d9819c425fc885678ffea9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 107/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f1100c6..d866509 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -36,7 +36,7 @@ namespace Marco.Pms.Services.Helpers List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); @@ -118,7 +118,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -233,6 +232,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); @@ -301,14 +301,14 @@ namespace Marco.Pms.Services.Helpers { foreach (var tag in createContact.Tags) { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) + if (tagNames.Contains(tag.Name.ToLower())) { - ContactTagMapping tagMapping = new ContactTagMapping + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); + _context.ContactTagMappings.Add(new ContactTagMapping { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); + ContactId = contact.Id, + ContactTagtId = tag.Id ?? existingTag.Id + }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) { @@ -373,7 +373,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -407,10 +406,12 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -530,12 +531,13 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + if (tagNames.Contains(tag.Name.ToLower())) { + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id.Value + ContactTagtId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -574,19 +576,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 9af085c2fd4d7c6a3462c984bd560b4810113082 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 14:33:14 +0530 Subject: [PATCH 108/469] Added an API to deleted ContactTag as well remove entries in contact-tag mapping table related to that tag --- .../Controllers/MasterController.cs | 7 ++--- Marco.Pms.Services/Helpers/MasterHelper.cs | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index e782913..1ba1ee9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -680,7 +680,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-category/{id})")] + [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { return Ok(); @@ -726,7 +726,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-tag/{id})")] + [HttpGet("contact-tag/{id}")] public async Task GetContactTagMaster(Guid id) { return Ok(); @@ -768,7 +768,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-tag/{id}")] public async Task DeletecontactTagMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactTag(id); + return Ok(response); } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 33fab6b..ac05b97 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -139,7 +139,33 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactTag(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactTag != null) + { + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + _context.ContactTagMasters.Remove(contactTag); + if (tagMappings.Any()) + { + _context.ContactTagMappings.RemoveRange(tagMappings); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact tag {ContactTagId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Tag {ContactTagId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Tag deleted successfully", 200); + } } } -- 2.43.0 From 24968be0fff4d9c481639209cb38aa64b930c402 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:13:35 +0530 Subject: [PATCH 109/469] added an API to get a list of contact-notes by contact ID --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 22 ++++++ .../ViewModels/Directory/ContactNoteVM.cs | 9 +++ .../Controllers/DirectoryController.cs | 67 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 +++++++ 4 files changed, 121 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index f78c260..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -188,5 +188,27 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + + //Contact Note + public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) + { + return new ContactNote + { + Note = noteDto.Note, + ContactId = noteDto.ContactId, + CreatedAt = DateTime.UtcNow, + CreatedById = employeeId, + TenantId = tenantId + }; + } + public static ContactNoteVM ToContactNoteVMFromContactNote(this ContactNote note) + { + return new ContactNoteVM + { + Id = note.Id, + Note = note.Note, + ContactId = note.ContactId + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs new file mode 100644 index 0000000..5e1c340 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactNoteVM + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index bd49e18..dd3785e 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,73 @@ namespace Marco.Pms.Services.Controllers } } + // -------------------------------- Contact Notes -------------------------------- + + [HttpPost("note")] + public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.CreateContactNote(noteDto); + //if (response.StatusCode == 200) + //{ + //return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpGet("note/{ContactId}")] + public async Task GetNoteListByContactId(Guid contactId) + { + var response = await _directoryHelper.GetNoteListByContactId(contactId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPut("note/{id}")] + public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.UpdateContactNote(id, noteDto); + //if (response.StatusCode == 200) + //{ + // return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpDelete("note/{id}")] + public async Task DeleteContactNote(Guid id) + { + return Ok(); + //var response = await _directoryHelper.DeleteContactNote(id); + //return Ok(response); + } + + // -------------------------------- Bucket -------------------------------- [HttpGet("buckets")] public async Task GetBucketList() diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d866509..b68a854 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -624,6 +624,29 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + // -------------------------------- Contact Notes -------------------------------- + + public async Task> GetNoteListByContactId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + noteVMs.Add(noteVM); + } + _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 4492c60159fe1b95e5f40ef30fc3119e5c2d5624 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 110/469] Added an API to get contact category by its size --- .../Controllers/MasterController.cs | 14 +++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 1ba1ee9..61baaa3 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -683,7 +683,19 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.GetContactCategoryById(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-category")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ac05b97..11015c8 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -47,7 +47,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -63,6 +62,22 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> GetContactCategoryById(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var category = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (category != null) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + _logger.LogInfo("Employee {EmployeeId} fetched contact category {ContactCategoryID}", LoggedInEmployee.Id, category.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category fetched successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} attempted to fetch contact category {ContactCategoryID} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } public async Task> DeleteContactCategory(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From b381397e40b95e6a5978490472153f0104dfdcbf Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 111/469] Added an API to Update existing Contact-note --- .../Controllers/DirectoryController.cs | 60 +++++++++---------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 ++++++++++++ 2 files changed, 67 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index dd3785e..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -104,20 +104,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("note")] public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.CreateContactNote(noteDto); - //if (response.StatusCode == 200) - //{ - //return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + + var response = await _directoryHelper.CreateContactNote(noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpGet("note/{ContactId}")] @@ -141,28 +141,26 @@ namespace Marco.Pms.Services.Controllers [HttpPut("note/{id}")] public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.UpdateContactNote(id, noteDto); - //if (response.StatusCode == 200) - //{ - // return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + var response = await _directoryHelper.UpdateContactNote(id, noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("note/{id}")] public async Task DeleteContactNote(Guid id) { - return Ok(); - //var response = await _directoryHelper.DeleteContactNote(id); - //return Ok(response); + var response = await _directoryHelper.DeleteContactNote(id); + return Ok(response); } // -------------------------------- Bucket -------------------------------- diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b68a854..a185a1d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -647,6 +647,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 70ec3b6a4479c20f132cf1de8318df341ea0f317 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 112/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a185a1d..9861a15 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -684,6 +684,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From a752bc39fe8cc0cc0b14854db58d14af7d9bc799 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:43 +0530 Subject: [PATCH 113/469] Added an API to add a note to specific contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9861a15..ebaeb4e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -646,7 +646,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - + public async Task> CreateContactNote(CreateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote note = noteDto.ToContactNoteFromCreateContactNoteDto(tenantId, LoggedInEmployee.Id); + _context.ContactNotes.Add(note); + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + _logger.LogInfo("Employee {EmployeeId} Added note at contact {ContactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note added successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to add a note to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From c25a7c4b9c1323ba6b2a204fef09796b561f22ba Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 114/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..12951b9 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -29,6 +29,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, -- 2.43.0 From e3e19a938abdefcc0ea12eaead762c01296fa51c Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 115/469] created GetListOfContact custome function --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ebaeb4e..6ee029b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -787,4 +787,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } -} + } -- 2.43.0 From 34f32bdd3367147fb49cac40d823517cd3ad387a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 116/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 6ee029b..e197d31 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -786,5 +786,114 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } -- 2.43.0 From aa605515246f1c118ad4cb36b13e71f1d4c06f83 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 117/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index e197d31..5eeb0bd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -896,4 +896,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From 53c210915a926a1dfe3b7d73263c069c158de19a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 118/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 11015c8..ede969e 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -112,6 +112,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 2d126bf5b9e173783dec31f4eab673063fbb566d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 119/469] Added an API to update existing contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 1 file changed, 227 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5eeb0bd..ebd5e49 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -845,17 +845,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -892,8 +907,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From 9fa33517958a58f65a33d1c5d9dcc55462bdef78 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 120/469] added api to get list of contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ede969e..ef8f7f0 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; -- 2.43.0 From 5a487076ab79b1b87930e49414a406a71c434433 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 121/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ebd5e49..21c9b4b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1116,5 +1116,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From b41640a12085dbbbc1b6b797398d0d40833ca8ed Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 122/469] Added an API to create a contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ef8f7f0..ede969e 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; -- 2.43.0 From c785b270f07b6404ff007f9fd9dd658d03d0cbf4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 123/469] Added an API to create bucket --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 21c9b4b..fa323d1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1138,5 +1138,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From 2d939e53728593e44c57e73cf31caf454c25c2f3 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 124/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index fa323d1..9dbacff 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1060,7 +1060,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From f50cb8e2dddcd5a535649d6e1a79e56ae5b96579 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 125/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 - .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 388 --- 7 files changed, 3141 insertions(+), 390 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 13cd596..8fbd855 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -100,6 +100,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 12951b9..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -29,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..b368b47 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -58,6 +58,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9dbacff..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -787,393 +787,5 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> CreateContact(CreateContactDto createContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (createContact != null) - { - List phones = new List(); - List emails = new List(); - List contactBucketMappings = new List(); - List contactTagMappings = new List(); - - Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); - - _context.Contacts.Add(contact); - await _context.SaveChangesAsync(); - _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); - - var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); - var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - if (createContact.ContactPhones != null) - { - - foreach (var contactPhone in createContact.ContactPhones) - { - ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); - phones.Add(phone); - } - _context.ContactsPhones.AddRange(phones); - _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.ContactEmails != null) - { - - foreach (var contactEmail in createContact.ContactEmails) - { - ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); - emails.Add(email); - } - _context.ContactsEmails.AddRange(emails); - _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.BucketIds != null) - { - foreach (var bucket in createContact.BucketIds) - { - if (buckets.Contains(bucket)) - { - ContactBucketMapping bucketMapping = new ContactBucketMapping - { - BucketId = bucket, - ContactId = contact.Id - }; - contactBucketMappings.Add(bucketMapping); - } - } - _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); - } - if (createContact.Tags != null) - { - foreach (var tag in createContact.Tags) - { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) - { - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) - { - var newtag = new ContactTagMaster - { - Name = tag.Name - }; - _context.ContactTagMasters.Add(newtag); - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagtId = newtag.Id, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - } - _context.ContactTagMappings.AddRange(contactTagMappings); - } - await _context.SaveChangesAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTagMappings) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - - return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContact != null) - { - if (updateContact.Id != id) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); - } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contact == null) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); - - List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var phoneIds = phones.Select(p => p.Id).ToList(); - List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var emailIds = emails.Select(p => p.Id).ToList(); - - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); - - List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - - if (updateContact.ContactPhones != null) - { - var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); - foreach (var phoneDto in updateContact.ContactPhones) - { - var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); - if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Update(phone); - } - else - { - _context.ContactsPhones.Add(phone); - } - } - foreach (var phone in phones) - { - - if (!updatedPhoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Remove(phone); - } - } - } - else if (phones != null) - { - _context.ContactsPhones.RemoveRange(phones); - } - - if (updateContact.ContactEmails != null) - { - var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); - - foreach (var emailDto in updateContact.ContactEmails) - { - var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); - if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) - { - _context.ContactsEmails.Update(email); - } - else - { - _context.ContactsEmails.Add(email); - } - } - foreach (var email in emails) - { - - if (!updateEmailIds.Contains(email.Id)) - { - _context.ContactsEmails.Remove(email); - } - } - } - else if (emails != null) - { - _context.ContactsEmails.RemoveRange(emails); - } - - if (updateContact.BucketIds != null) - { - foreach (var bucketId in updateContact.BucketIds) - { - if (!bucketIds.Contains(bucketId)) - { - _context.ContactBucketMappings.Add(new ContactBucketMapping - { - BucketId = bucketId, - ContactId = contact.Id - }); - } - } - foreach (var bucketMapping in contactBuckets) - { - if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) - { - _context.ContactBucketMappings.Remove(bucketMapping); - } - } - } - else if (contactBuckets != null) - { - _context.ContactBucketMappings.RemoveRange(contactBuckets); - } - - if (updateContact.Tags != null) - { - var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); - foreach (var tag in updateContact.Tags) - { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) - { - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagtId = tag.Id.Value - }); - } - else if (tag.Id == null || tag.Id == Guid.Empty) - { - ContactTagMaster contactTag = new ContactTagMaster - { - Name = tag.Name, - Description = "" - }; - _context.ContactTagMasters.Add(contactTag); - - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagtId = contactTag.Id - }); - } - } - foreach (var contactTag in contactTags) - { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) - { - _context.ContactTagMappings.Remove(contactTag); - } - } - } - else if (contactTags != null) - { - _context.ContactTagMappings.RemoveRange(contactTags); - } - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contact.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - - phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTags) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - - // -------------------------------- Bucket -------------------------------- - - public async Task> GetBucketList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - - List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); - - List bucketVMs = new List(); - foreach (var bucket in bucketList) - { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); - } - _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); - } - - public async Task> CreateBucket(CreateBucketDto bucketDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (bucketDto != null) - { - var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); - if (existingBucket != null) - { - _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); - } - Bucket bucket = new Bucket - { - Name = bucketDto.Name, - Description = bucketDto.Description, - TenantId = tenantId - }; - _context.Buckets.Add(bucket); - - EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping - { - EmployeeId = LoggedInEmployee.Id, - BucketId = bucket.Id - }; - - _context.EmployeeBucketMappings.Add(employeeBucket); - await _context.SaveChangesAsync(); - - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } } } -- 2.43.0 From 57d430be1e4ae7801bef75b6aec297885b2ca2b4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 126/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 77 +- 12 files changed, 20 insertions(+), 3285 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 8fbd855..13cd596 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -100,7 +100,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 329b474..ddf9c0c 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,6 +320,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -475,32 +478,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2473,33 +2450,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..8197c94 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b368b47..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -58,24 +58,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..157c62d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,19 +31,14 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -61,10 +56,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -74,7 +68,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -84,7 +78,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -97,17 +91,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -234,8 +220,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -258,7 +242,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -274,29 +257,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -314,8 +276,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -326,20 +287,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -365,8 +318,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -545,8 +496,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -559,7 +509,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -582,10 +532,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -614,9 +560,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From a97b95eb001a8248d6494b2f0ae19616ae8adf62 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 127/469] Added an API to delete existing contact category --- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ede969e..a26f401 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -127,6 +127,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 65a0e60c8a72f53075f09245b7927245597ce2c5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 128/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 +++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 77 ++++++++++++++++--- 8 files changed, 145 insertions(+), 20 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index ddf9c0c..329b474 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2450,6 +2473,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 8197c94..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 157c62d..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,14 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -56,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -68,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -78,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -91,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -220,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -242,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -257,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -276,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -287,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -318,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -496,7 +545,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -509,7 +559,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -532,6 +582,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -560,6 +614,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 50f698bf896d09bd6791a352da4c329781147ab9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 129/469] properly mapped the updated Dto to contact table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..cfbc4d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -576,7 +576,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From d014fcd1e4328a994498b2e7223ffb830415c23c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 130/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index cfbc4d0..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -576,19 +576,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 5f90ddf454a7902cebf09da541249b1bf0974616 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 131/469] Added an API to get contact category by its size --- Marco.Pms.Services/Helpers/MasterHelper.cs | 49 ---------------------- 1 file changed, 49 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index a26f401..11015c8 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -112,55 +112,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } - public async Task> DeleteContactCategory(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contactCategory != null) - { - List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); - if (existingContacts.Count > 0) - { - List? contacts = new List(); - foreach (var contact in existingContacts) - { - contact.ContactCategoryId = null; - contacts.Add(contact); - } - _context.Contacts.UpdateRange(contacts); - } - _context.ContactCategoryMasters.Remove(contactCategory); - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); - } - // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 77a1cfd9dc352b0bf98e48bad87f74ff15f87552 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 132/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..0cad29c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -728,6 +728,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 13b93d5bd539441c669b633df95946f5196fe520 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 133/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 0cad29c..980fb68 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -765,6 +765,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 999b2f06e029bb804bdd378aa34b602946851bb0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 10:57:17 +0530 Subject: [PATCH 134/469] Corrected the typo of ContactTagtId to ContactTagId --- ...Added_Directory_Related_Tables.Designer.cs | 3 --- ...14103249_Added_Directory_Related_Tables.cs | 6 ++--- ...ed_ContactProjectMapping_Table.Designer.cs | 2 -- .../ApplicationDbContextModelSnapshot.cs | 3 --- .../Directory/ContactTagMapping.cs | 2 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 26 +++++++++---------- Marco.Pms.Services/Helpers/MasterHelper.cs | 2 +- 7 files changed, 17 insertions(+), 27 deletions(-) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs index f50346e..aad7361 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -493,9 +493,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - b.HasKey("Id"); b.HasIndex("ContactId"); diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs index 879f54b..7ef6da4 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable @@ -289,8 +288,7 @@ namespace Marco.Pms.DataAccess.Migrations { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + ContactTagId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs index 18a4be6..492cf00 100644 --- a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -516,8 +516,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); b.HasKey("Id"); diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 329b474..5662c46 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -513,9 +513,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - b.HasKey("Id"); b.HasIndex("ContactId"); diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs index a3d7e9e..91c2835 100644 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -5,7 +5,7 @@ public Guid Id { get; set; } public Guid ContactId { get; set; } public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } + public Guid ContactTagId { get; set; } public ContactTagMaster? ContactTag { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 980fb68..5920cbd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Services.Helpers var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + List TagIds = Tags.Select(t => t.ContactTagId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -89,7 +89,7 @@ namespace Marco.Pms.Services.Helpers foreach (var tagMapping in tagMappingss) { ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); conatctTagVms.Add(tagVM); @@ -147,7 +147,7 @@ namespace Marco.Pms.Services.Helpers List tagMasters = new List(); if (tags.Count > 0) { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagIds = tags.Select(ct => ct.ContactTagId).ToList(); tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); } @@ -188,7 +188,7 @@ namespace Marco.Pms.Services.Helpers { foreach (var contactTag in contactTags) { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagId); if (tagMaster != null) { ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); @@ -307,7 +307,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) @@ -320,7 +320,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = newtag.Id, + ContactTagId = newtag.Id, ContactId = contact.Id }; contactTagMappings.Add(tagMapping); @@ -336,7 +336,7 @@ namespace Marco.Pms.Services.Helpers List phoneVMs = new List(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + var tagIds = contactTagMappings.Select(t => t.ContactTagId).ToList(); tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); @@ -355,7 +355,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTagMappings) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } @@ -404,7 +404,7 @@ namespace Marco.Pms.Services.Helpers var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); @@ -537,7 +537,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -553,7 +553,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = contactTag.Id + ContactTagId = contactTag.Id }); } } @@ -584,7 +584,7 @@ namespace Marco.Pms.Services.Helpers contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); @@ -604,7 +604,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTags) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 11015c8..4d29908 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -161,7 +161,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contactTag != null) { - List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagId == contactTag.Id).ToListAsync(); _context.ContactTagMasters.Remove(contactTag); if (tagMappings.Any()) -- 2.43.0 From d4b2d6025d2e59e48b3aeb78e6e80ca4359fda58 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 11:09:30 +0530 Subject: [PATCH 135/469] Addd migrations fro Typo --- ...53019_Fixed_Typo_Of_ColumnName.Designer.cs | 3007 +++++++++++++++++ ...20250519053019_Fixed_Typo_Of_ColumnName.cs | 64 + .../ApplicationDbContextModelSnapshot.cs | 6 +- 3 files changed, 3075 insertions(+), 2 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs diff --git a/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs new file mode 100644 index 0000000..39fe4c3 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs @@ -0,0 +1,3007 @@ +// +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("20250519053019_Fixed_Typo_Of_ColumnName")] + partial class Fixed_Typo_Of_ColumnName + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Grants a user the ability to record their own work hours or presence within the system. This typically involves checking in and checking out, logging break times, and potentially viewing their own attendance history.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage 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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs new file mode 100644 index 0000000..5b33d21 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Fixed_Typo_Of_ColumnName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings"); + + migrationBuilder.AlterColumn( + name: "ContactTagId", + table: "ContactTagMappings", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci", + oldClrType: typeof(Guid), + oldType: "char(36)", + oldNullable: true) + .OldAnnotation("Relational:Collation", "ascii_general_ci"); + + migrationBuilder.AddForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId", + principalTable: "ContactTagMasters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings"); + + migrationBuilder.AlterColumn( + name: "ContactTagId", + table: "ContactTagMappings", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci", + oldClrType: typeof(Guid), + oldType: "char(36)") + .OldAnnotation("Relational:Collation", "ascii_general_ci"); + + migrationBuilder.AddForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId", + principalTable: "ContactTagMasters", + principalColumn: "Id"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 5662c46..bbd22d7 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -510,7 +510,7 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactId") .HasColumnType("char(36)"); - b.Property("ContactTagId") + b.Property("ContactTagId") .HasColumnType("char(36)"); b.HasKey("Id"); @@ -2507,7 +2507,9 @@ namespace Marco.Pms.DataAccess.Migrations b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") .WithMany() - .HasForeignKey("ContactTagId"); + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); b.Navigation("Contact"); -- 2.43.0 From efc5e22f7bfe2387b2af209b186c795098180abf Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 13:18:32 +0530 Subject: [PATCH 136/469] Changed tag validation --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5920cbd..ee4751e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -411,7 +411,8 @@ namespace Marco.Pms.Services.Helpers var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); + List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -531,7 +532,10 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tagNames.Contains(tag.Name.ToLower())) + var namecheck = tagNames.Contains(tag.Name.ToLower()); + var idCheck = (!tagIds.Contains(tag.Id ?? Guid.Empty)); + var test = namecheck && idCheck; + if (test) { ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping @@ -559,7 +563,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 811e0ac80769939a24c39ad4a6bb603d63bebb91 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 09:46:03 +0530 Subject: [PATCH 137/469] Created an API to get contact profile by its Id --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 18 ++- .../ViewModels/Directory/ContactNoteVM.cs | 8 +- .../ViewModels/Directory/ContactProfileVM.cs | 26 ++++ .../ViewModels/Projects/BasicProjectVM.cs | 8 ++ .../Controllers/DirectoryController.cs | 14 ++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 121 +++++++++++++++++- 6 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -51,6 +51,20 @@ namespace Marco.Pms.Model.Mapper Address = contact.Address ?? string.Empty }; } + public static ContactProfileVM ToContactProfileVMFromContact(this Contact contact) + { + return new ContactProfileVM + { + Id = contact.Id, + Name = contact.Name, + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty, + CreatedAt = contact.CreatedAt, + CreatedBy = contact.CreatedBy != null ? contact.CreatedBy.ToBasicEmployeeVMFromEmployee() : null + }; + } //Contact Phone Mapper public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) @@ -207,7 +221,9 @@ namespace Marco.Pms.Model.Mapper { Id = note.Id, Note = note.Note, - ContactId = note.ContactId + ContactId = note.ContactId, + CreatedAt = note.CreatedAt, + CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null }; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs index 5e1c340..c3ca209 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -1,9 +1,15 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class ContactNoteVM { public Guid Id { get; set; } public string Note { get; set; } = string.Empty; + public DateTime CreatedAt { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } + public DateTime? UpdatedAt { get; set; } + public BasicEmployeeVM? UpdatedBy { get; set; } public Guid ContactId { get; set; } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs new file mode 100644 index 0000000..8103c5c --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs @@ -0,0 +1,26 @@ +using Marco.Pms.Model.ViewModels.Activities; +using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Model.ViewModels.Projects; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactProfileVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public DateTime CreatedAt { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } + public DateTime? UpdatedAt { get; set; } + public BasicEmployeeVM? UpdatedBy { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } + public List? Projects { get; set; } + public List? Buckets { get; set; } + public List? Tags { get; set; } + public List? Notes { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs b/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs new file mode 100644 index 0000000..e08caa9 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Projects +{ + public class BasicProjectVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..12317d3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,20 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("profile/{id}")] + public async Task GetContactProfile(Guid id) + { + var response = await _directoryHelper.GetContactProfile(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ee4751e..c3f0ae0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2,9 +2,11 @@ using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Projects; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Model.ViewModels.Projects; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.EntityFrameworkCore; @@ -213,7 +215,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -627,6 +628,121 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactProfile(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.Include(c => c.ContactCategory).Include(c => c.CreatedBy).FirstOrDefaultAsync(c => c.Id == id && c.IsActive); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + ContactProfileVM contactVM = contact.ToContactProfileVMFromContact(); + DirectoryUpdateLog? updateLog = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => l.RefereanceId == contact.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefaultAsync(); + if (updateLog != null) + { + contactVM.UpdatedAt = updateLog.UpdateAt; + contactVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + + List? phones = await _context.ContactsPhones.Where(p => p.ContactId == contact.Id).ToListAsync(); + if (phones.Any()) + { + List? phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + contactVM.ContactPhones = phoneVMs; + } + + List? emails = await _context.ContactsEmails.Where(e => e.ContactId == contact.Id).ToListAsync(); + if (emails.Any()) + { + List? emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + contactVM.ContactEmails = emailVMs; + } + + List? contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + if (contactProjects.Any()) + { + List projectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + List? projects = await _context.Projects.Where(p => projectIds.Contains(p.Id) && p.TenantId == tenantId).ToListAsync(); + List? projectVMs = new List(); + foreach (var project in projects) + { + BasicProjectVM projectVM = new BasicProjectVM + { + Id = project.Id, + Name = project.Name + }; + projectVMs.Add(projectVM); + } + contactVM.Projects = projectVMs; + } + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + if (contactBuckets.Any() && employeeBuckets.Any()) + { + List contactBucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + List employeeBucketIds = employeeBuckets.Select(eb => eb.BucketId).ToList(); + List? buckets = await _context.Buckets.Where(b => contactBucketIds.Contains(b.Id) && employeeBucketIds.Contains(b.Id)).ToListAsync(); + List? bucketVMs = new List(); + foreach (var bucket in buckets) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + contactVM.Buckets = bucketVMs; + } + List? contactTags = await _context.ContactTagMappings.Where(ct => ct.ContactId == contact.Id).ToListAsync(); + if (contactTags.Any()) + { + List tagIds = contactTags.Select(ct => ct.ContactTagId).ToList(); + List tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + List tagVMs = new List(); + foreach (var tagMaster in tagMasters) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + contactVM.Tags = tagVMs; + } + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + if (notes.Any()) + { + List? noteIds = notes.Select(n => n.Id).ToList(); + List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.Id)).OrderByDescending(l => l.UpdateAt).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + DirectoryUpdateLog? noteUpdateLog = noteUpdateLogs.Where(n => n.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + if (noteUpdateLog != null) + { + noteVM.UpdatedAt = noteUpdateLog.UpdateAt; + noteVM.UpdatedBy = noteUpdateLog.Employee != null ? noteUpdateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + noteVMs.Add(noteVM); + } + contactVM.Notes = noteVMs; + } + _logger.LogInfo("Employee ID {EmployeeId} fetched profile of contact {COntactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact profile fetched successfully"); + + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- @@ -695,7 +811,8 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - + noteVM.UpdatedAt = DateTime.UtcNow; + noteVM.UpdatedBy = LoggedInEmployee.ToBasicEmployeeVMFromEmployee(); _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); -- 2.43.0 From ac7197c1977221d4ddac600a712b10067a7eb440 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 12:38:09 +0530 Subject: [PATCH 138/469] changed all list in contact profile view model to non-nullable and set default value to empty list --- .../ViewModels/Directory/ContactProfileVM.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs index 8103c5c..9e8f4cb 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs @@ -15,12 +15,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public BasicEmployeeVM? CreatedBy { get; set; } public DateTime? UpdatedAt { get; set; } public BasicEmployeeVM? UpdatedBy { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } + public List ContactPhones { get; set; } = new List(); + public List ContactEmails { get; set; } = new List(); public ContactCategoryVM? ContactCategory { get; set; } - public List? Projects { get; set; } - public List? Buckets { get; set; } - public List? Tags { get; set; } - public List? Notes { get; set; } + public List Projects { get; set; } = new List(); + public List Buckets { get; set; } = new List(); + public List Tags { get; set; } = new List(); + public List Notes { get; set; } = new List(); } } -- 2.43.0 From afbfea3fc00540193830b7af9643b85816b7a6ff Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 10:28:17 +0530 Subject: [PATCH 139/469] Implemented an API to retrieve a list of organizations provided in the contacts. --- Marco.Pms.Services/Controllers/DirectoryController.cs | 7 +++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 12317d3..8f2cb5c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -113,6 +113,13 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("organization")] + public async Task GetOrganizationList() + { + var response = await _directoryHelper.GetOrganizationList(); + return Ok(response); + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c3f0ae0..da8514a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -743,6 +743,15 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); } + public async Task> GetOrganizationList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var organizationList = await _context.Contacts.Where(c => c.TenantId == tenantId).Select(c => c.Organization).Distinct().ToListAsync(); + _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); + return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From 8f267f9ef9fac4dfe47c043238868666e9e87612 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Tue, 20 May 2025 10:00:57 +0530 Subject: [PATCH 140/469] created api for contact Tag Update --- .../Controllers/MasterController.cs | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 61baaa3..36a3ee8 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,6 +1,8 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -638,8 +640,7 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - _logger.LogError("User sent empyt payload"); - return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); + } [HttpDelete("work-category/{id}")] @@ -774,7 +775,36 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag/edit/{id}")] public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) { - return Ok(); + + var tenantId = _userHelper.GetTenantId(); + Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContactTagDto != null && updateContactTagDto.Id != id) + { + ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); + if(contactTag != null) + { + contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); + _context.ContactTagMasters.Update(contactTag); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactTag.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + + ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); + + + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); + return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); + } + } + _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); + return NotFound(ApiResponse.ErrorResponse("Contact Tag master not found", "Work category master not found", 404)); + } [HttpDelete("contact-tag/{id}")] -- 2.43.0 From 616cebbf9406195d7169137ac579ea01f06b6013 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 17:29:20 +0530 Subject: [PATCH 141/469] Implemented an API to suspend a Contact --- .../Controllers/DirectoryController.cs | 22 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 8f2cb5c..843aacb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -107,6 +107,10 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 404) + { + return NotFound(response); + } else { return BadRequest(response); @@ -120,6 +124,24 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } + [HttpDelete("{id}")] + public async Task DeleteContact(Guid id) + { + var response = await _directoryHelper.DeleteContact(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index da8514a..68562ac 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -752,6 +752,26 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } + public async Task> DeleteContact(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + contact.IsActive = false; + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From a9d20b80777b9825a9338983372d7b52b0118357 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 13:05:08 +0000 Subject: [PATCH 142/469] Update Marco.Pms.Services/Helpers/DirectoryHelper.cs Added entrie to DirectoryUpdateLog Table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 68562ac..aacd71a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -765,6 +765,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } contact.IsActive = false; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); -- 2.43.0 From 62f9b2256e5a57d81df60714cc8e289240cec1ba Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 17:26:51 +0530 Subject: [PATCH 143/469] Implemented filtering functionality for Get Contact List API --- .../Dtos/Directory/ContactFilterDto.cs | 9 ++++ .../Controllers/DirectoryController.cs | 4 +- .../Controllers/MasterController.cs | 9 ++-- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 41 +++++++++++++++++-- 4 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs new file mode 100644 index 0000000..3f06388 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactFilterDto + { + public List? BucketIds { get; set; } + public List? CategoryIds { get; set; } + + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 843aacb..2e6db54 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList() + public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(); + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); if (response.StatusCode == 200) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 36a3ee8..dc4cd61 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -640,7 +640,8 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - + _logger.LogError("User sent empyt payload"); + return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); } [HttpDelete("work-category/{id}")] @@ -781,7 +782,7 @@ namespace Marco.Pms.Services.Controllers if (updateContactTagDto != null && updateContactTagDto.Id != id) { ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); - if(contactTag != null) + if (contactTag != null) { contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); _context.ContactTagMasters.Update(contactTag); @@ -796,8 +797,8 @@ namespace Marco.Pms.Services.Controllers ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); - - + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index aacd71a..cebba78 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -29,17 +29,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts() + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - + if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) + { + bucketIds = filterDto.BucketIds; + } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + List contacts = new List(); + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) + { + var categoryIds = filterDto.CategoryIds; + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && categoryIds.Contains(c.ContactCategoryId ?? Guid.Empty) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } + else + { + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); @@ -50,6 +62,19 @@ namespace Marco.Pms.Services.Helpers var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + if (search != null && search != string.Empty) + { + List filteredContactIds = new List(); + phoneNo = phoneNo.Where(p => Compare(p.PhoneNumber, search)).ToList(); + filteredContactIds = phoneNo.Select(p => p.ContactId).ToList(); + + Emails = Emails.Where(e => Compare(e.EmailAddress, search)).ToList(); + filteredContactIds.AddRange(Emails.Select(e => e.ContactId).ToList()); + filteredContactIds = filteredContactIds.Distinct().ToList(); + + contacts = contacts.Where(c => Compare(c.Name, search) || Compare(c.Organization, search) || filteredContactIds.Contains(c.Id)).ToList(); + } + List list = new List(); foreach (var contact in contacts) @@ -66,6 +91,7 @@ namespace Marco.Pms.Services.Helpers var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); + if (emails != null && emails.Count > 0) { foreach (var email in emails) @@ -1005,5 +1031,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + private bool Compare(string sentence, string search) + { + sentence = sentence.Trim().ToLower(); + search = search.Trim().ToLower(); + + // Check for exact substring + bool result = sentence.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; + return result; + } } } -- 2.43.0 From 13d8935b72a0788f03f4c410e405038c5ab45162 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 22:10:51 +0530 Subject: [PATCH 144/469] Accepting List of buckets and categories Ids rather than as payload --- .../Controllers/DirectoryController.cs | 13 ++++++++---- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 2e6db54..ba05625 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,14 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) + public async Task GetContactList([FromQuery] string? search, [FromQuery] List? bucketIds, [FromQuery] List? categoryIds, [FromQuery] Guid? projectId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); + ContactFilterDto filterDto = new ContactFilterDto + { + BucketIds = bucketIds, + CategoryIds = categoryIds + }; + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto, projectId); if (response.StatusCode == 200) @@ -164,9 +169,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet("note/{ContactId}")] - public async Task GetNoteListByContactId(Guid contactId) + public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetNoteListByContactId(contactId); + var response = await _directoryHelper.GetNoteListByContactId(contactId, active); if (response.StatusCode == 200) { return Ok(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index cebba78..36c6884 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -29,20 +29,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto, Guid? projectId) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { - bucketIds = filterDto.BucketIds; + filterbucketIds = filterDto.BucketIds; } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + List contactIds = contactBuckets.Where(b => filterbucketIds.Contains(b.BucketId)).Select(cb => cb.ContactId).ToList(); List contacts = new List(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + if (projectId != null && projectId != Guid.Empty) + { + contactProjects = contactProjects.Where(p => p.ProjectId == projectId).ToList(); + contactIds = contactProjects.Select(p => p.ContactId).Distinct().ToList(); + } + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) { var categoryIds = filterDto.CategoryIds; @@ -56,7 +65,6 @@ namespace Marco.Pms.Services.Helpers var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); List TagIds = Tags.Select(t => t.ContactTagId).ToList(); @@ -809,14 +817,14 @@ namespace Marco.Pms.Services.Helpers // -------------------------------- Contact Notes -------------------------------- - public async Task> GetNoteListByContactId(Guid id) + public async Task> GetNoteListByContactId(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { -- 2.43.0 From 2ce81b8b9ab44f4af933f15bb6d6440ec6b93d1e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 19:48:45 +0530 Subject: [PATCH 145/469] Implemented an API to update Buckets for grouping contacts. --- .../Dtos/Directory/UpdateBucketDto.cs | 9 ++++++ .../Controllers/DirectoryController.cs | 18 +++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 31 ++++++++++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs new file mode 100644 index 0000000..4428941 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateBucketDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index ba05625..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -247,5 +247,23 @@ namespace Marco.Pms.Services.Controllers } } + + [HttpPut("bucket/{id}")] + public async Task UpdateBucket(Guid id, [FromBody] UpdateBucketDto bucketDto) + { + var response = await _directoryHelper.UpdateBucket(id, bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 36c6884..8cf2b1e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1001,7 +1001,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } - public async Task> CreateBucket(CreateBucketDto bucketDto) { Guid tenantId = _userHelper.GetTenantId(); @@ -1038,7 +1037,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateBucket(Guid id, UpdateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null && id == bucketDto.Id) + { + var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + bucket.Name = bucketDto.Name ?? ""; + bucket.Description = bucketDto.Description ?? ""; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketDto.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 80a22741b2ccda306ea6f757db13895c38b36c93 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 20:27:13 +0530 Subject: [PATCH 146/469] Implemented an API to update Contact Category Master --- .../Controllers/MasterController.cs | 55 +++++++--------- Marco.Pms.Services/Helpers/MasterHelper.cs | 65 +++++++++++++++++++ 2 files changed, 89 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index dc4cd61..3512081 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,8 +1,6 @@ using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -717,11 +715,22 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } - [HttpPost("contact-category/edit/{id}")] public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) { - return Ok(); + var response = await _masterHelper.UpdateContactCategory(id, updateContactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("contact-category/{id}")] @@ -776,36 +785,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag/edit/{id}")] public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) { - - var tenantId = _userHelper.GetTenantId(); - Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContactTagDto != null && updateContactTagDto.Id != id) + var response = await _masterHelper.UpdateContactTag(id, updateContactTagDto); + if (response.StatusCode == 200) { - ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); - if (contactTag != null) - { - contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); - _context.ContactTagMasters.Update(contactTag); - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contactTag.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - - ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); - - - - _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); - return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); - } + return Ok(response); } - _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); - return NotFound(ApiResponse.ErrorResponse("Contact Tag master not found", "Work category master not found", 404)); + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("contact-tag/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 4d29908..55883f6 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,6 +1,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Master; @@ -47,6 +48,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContactCategory(Guid id, UpdateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null && id == contactCategoryDto.Id) + { + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Id == id); + if (contactCategory != null) + { + contactCategory.Name = contactCategoryDto.Name ?? ""; + contactCategory.Description = contactCategoryDto.Description ?? ""; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactCategory.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a contact category but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -154,6 +186,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContactTag(Guid id, UpdateContactTagDto contactTagDto) + { + var tenantId = _userHelper.GetTenantId(); + Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null && contactTagDto.Id != id) + { + ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == contactTagDto.Id); + if (contactTag != null) + { + contactTag = contactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); + _context.ContactTagMasters.Update(contactTag); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactTag.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + + ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); + + + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully by employee {EmployeeId}", contactTagVm.Id, LoggedInEmployee.Id); + ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200); + } + _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); + ApiResponse.ErrorResponse("Contact Tag master not found", "Contact tag master not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> DeleteContactTag(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From c4a1c52acd3c86361b59b30e9b9bf8af9d6271b4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 24 May 2025 15:45:43 +0530 Subject: [PATCH 147/469] Add Directory Management Feature with Permission Handling --- .../Data/ApplicationDbContext.cs | 17 +- ...d_Feature_Directory_Management.Designer.cs | 3055 +++++++++++++++++ ...4333_Added_Feature_Directory_Management.cs | 100 + .../ApplicationDbContextModelSnapshot.cs | 48 + Marco.Pms.Model/Directory/Bucket.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 + 6 files changed, 3219 insertions(+), 9 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 13cd596..14fab8c 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -496,17 +496,15 @@ namespace Marco.Pms.DataAccess.Data modelBuilder.Entity().HasData( new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Manage Project", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, new Feature { Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), Description = "Manage Infra", Name = "Manage Infra", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, - new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Task Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), 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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, - - new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Employee Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true }, new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true }, - new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } - //new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } + new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }, + new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Managing all directory related rights", Name = "Directory Management", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } + + //new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } ); modelBuilder.Entity().HasData( @@ -533,8 +531,11 @@ namespace Marco.Pms.DataAccess.Data new FeaturePermission { Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Regularize Attendance", Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records" }, new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency" }, - new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" } - //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("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" }, + + new FeaturePermission { Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Admin", Description = "Full control over all directories, including the ability to manage permissions for all directories in the system." }, + new FeaturePermission { Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Manager", Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories." }, + new FeaturePermission { Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory User", Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created." } //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/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs new file mode 100644 index 0000000..6e2f931 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs @@ -0,0 +1,3055 @@ +// +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("20250524074333_Added_Feature_Directory_Management")] + partial class Added_Feature_Directory_Management + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedByID"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Grants a user the ability to record their own work hours or presence within the system. This typically involves checking in and checking out, logging break times, and potentially viewing their own attendance history.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" + }); + }); + + 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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs new file mode 100644 index 0000000..1319786 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs @@ -0,0 +1,100 @@ +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 Added_Feature_Directory_Management : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CreatedAt", + table: "Buckets", + type: "datetime(6)", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "CreatedByID", + table: "Buckets", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.InsertData( + table: "Features", + columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" }, + values: new object[] { new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Managing all directory related rights", true, new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), "Directory Management" }); + + migrationBuilder.InsertData( + table: "FeaturePermissions", + columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" }, + values: new object[,] + { + { new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory User" }, + { new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), "Full control over all directories, including the ability to manage permissions for all directories in the system.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Admin" }, + { new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Manager" } + }); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_CreatedByID", + table: "Buckets", + column: "CreatedByID"); + + migrationBuilder.AddForeignKey( + name: "FK_Buckets_Employees_CreatedByID", + table: "Buckets", + column: "CreatedByID", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Buckets_Employees_CreatedByID", + table: "Buckets"); + + migrationBuilder.DropIndex( + name: "IX_Buckets_CreatedByID", + table: "Buckets"); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("0f919170-92d4-4337-abd3-49b66fc871bb")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("62668630-13ce-4f52-a0f0-db38af2230c5")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606")); + + migrationBuilder.DropColumn( + name: "CreatedAt", + table: "Buckets"); + + migrationBuilder.DropColumn( + name: "CreatedByID", + table: "Buckets"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index bbd22d7..7064d93 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -269,6 +269,12 @@ namespace Marco.Pms.DataAccess.Migrations .ValueGeneratedOnAdd() .HasColumnType("char(36)"); + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + b.Property("Description") .IsRequired() .HasColumnType("longtext"); @@ -282,6 +288,8 @@ namespace Marco.Pms.DataAccess.Migrations b.HasKey("Id"); + b.HasIndex("CreatedByID"); + b.HasIndex("TenantId"); b.ToTable("Buckets"); @@ -961,6 +969,30 @@ namespace Marco.Pms.DataAccess.Migrations FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" }); }); @@ -1305,6 +1337,14 @@ namespace Marco.Pms.DataAccess.Migrations IsActive = true, ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" }); }); @@ -2357,12 +2397,20 @@ namespace Marco.Pms.DataAccess.Migrations modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("CreatedBy"); + b.Navigation("Tenant"); }); diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs index 028b428..0d382c5 100644 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -1,4 +1,5 @@ -using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; namespace Marco.Pms.Model.Directory { @@ -6,6 +7,9 @@ namespace Marco.Pms.Model.Directory { public Guid Id { get; set; } public string Name { get; set; } = string.Empty; + public Guid CreatedByID { get; set; } + public Employee? CreatedBy { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8cf2b1e..c11f9a8 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1017,6 +1017,8 @@ namespace Marco.Pms.Services.Helpers { Name = bucketDto.Name, Description = bucketDto.Description, + CreatedAt = DateTime.UtcNow, + CreatedByID = LoggedInEmployee.Id, TenantId = tenantId }; _context.Buckets.Add(bucket); -- 2.43.0 From b638e35b252bce0765c7834a9fde7fed3d29bde7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:24:41 +0530 Subject: [PATCH 148/469] Enhancement #375: Update "Get Contact" API to Enforce Feature Permissions --- .../Controllers/DirectoryController.cs | 5 ++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 29 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..de262fb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -39,12 +39,17 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); } } + [HttpGet("contact-bucket/{bucketId}")] public async Task GetContactsListByBucketId(Guid bucketId) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 370e8fd..5cf83b1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -18,13 +18,18 @@ namespace Marco.Pms.Services.Helpers private readonly ApplicationDbContext _context; private readonly ILoggingService _logger; private readonly UserHelper _userHelper; - + private readonly Guid directoryAdmin; + private readonly Guid directoryManager; + private readonly Guid directoryUser; public DirectoryHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) { _context = context; _logger = logger; _userHelper = userHelper; + directoryAdmin = Guid.Parse("4286a13b-bb40-4879-8c6d-18e9e393beda"); + directoryManager = Guid.Parse("62668630-13ce-4f52-a0f0-db38af2230c5"); + directoryUser = Guid.Parse("0f919170-92d4-4337-abd3-49b66fc871bb"); } @@ -33,9 +38,29 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + if (permissionIds.Contains(directoryAdmin)) + { + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketIds = buckets.Select(b => b.Id).ToList(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + var createdBucketIds = buckets.Select(b => b.Id).ToList(); + bucketIds.AddRange(createdBucketIds); + bucketIds = bucketIds.Distinct().ToList(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a contacts, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + + List filterbucketIds = bucketIds; if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { filterbucketIds = filterDto.BucketIds; -- 2.43.0 From 9f53fb2df7dae3bfec5bea9bd3ffc09f58d9cc81 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:27:04 +0530 Subject: [PATCH 149/469] Enhancement #376: Update "Get Contact by Bucket ID" API to Enforce Feature Permissions --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5cf83b1..898f43f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -185,12 +185,37 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (id != Guid.Empty) { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} attempted access to bucket ID {BucketId}, but not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(em => em.BucketId == id).ToListAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + + EmployeeBucketMapping? employeeBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + employeeBucket = employeeBuckets.FirstOrDefault(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + employeeBucket = employeeBuckets.FirstOrDefault(eb => eb.EmployeeId == LoggedInEmployee.Id); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a contacts with in bucket {BucketId}, but do not have permission", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + if (employeeBucket == null) { _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); List contactVMs = new List(); if (contactBucket.Count > 0) -- 2.43.0 From db25c25b9b1d9e94a9deadc2f00dd9eb1d1ba687 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:28:22 +0530 Subject: [PATCH 150/469] Enhancement #377: Update "Update Contact" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 4 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index de262fb..6b54891 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -103,6 +103,10 @@ namespace Marco.Pms.Services.Controllers { return NotFound(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 898f43f..f5a3e1c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -476,6 +476,33 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + if (permissionIds.Contains(directoryAdmin)) + { + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketIds = buckets.Select(b => b.Id).ToList(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + var createdBucketIds = buckets.Select(b => b.Id).ToList(); + bucketIds.AddRange(createdBucketIds); + bucketIds = bucketIds.Distinct().ToList(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to update a contact, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id && bucketIds.Contains(m.BucketId)).ToListAsync(); + bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); await _context.SaveChangesAsync(); @@ -485,8 +512,7 @@ namespace Marco.Pms.Services.Helpers List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var emailIds = emails.Select(p => p.Id).ToList(); - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); -- 2.43.0 From 1e6b2d7527192227e2d46c23185645b0d08ee9f0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:32:51 +0530 Subject: [PATCH 151/469] Enhancement #378: Update "Get Bucket List" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 13 ++++++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 28 +++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 6b54891..d25c7e8 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -226,7 +226,18 @@ namespace Marco.Pms.Services.Controllers public async Task GetBucketList() { var response = await _directoryHelper.GetBucketList(); - return Ok(response); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } } [HttpPost("bucket")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f5a3e1c..3d27b73 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1002,20 +1002,38 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + List bucketList = new List(); + if (permissionIds.Contains(directoryAdmin)) + { + bucketList = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a buckets list, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } List bucketVMs = new List(); - foreach (var bucket in bucketList) + if (bucketList.Any()) { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } } _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); } public async Task> CreateBucket(CreateBucketDto bucketDto) { -- 2.43.0 From 1490cfc1959b8dc88ac52ee49c1f86538b4d171d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:35:09 +0530 Subject: [PATCH 152/469] Enhancement #380: Update "Create Bucket" API to Enforce Feature --- Marco.Pms.Services/Controllers/DirectoryController.cs | 4 ++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d25c7e8..680a708 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -261,6 +261,10 @@ namespace Marco.Pms.Services.Controllers { return Conflict(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 3d27b73..2b1604d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1041,6 +1041,15 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (bucketDto != null) { + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var demo = !permissionIds.Contains(directoryUser); + if (!permissionIds.Contains(directoryAdmin) && !permissionIds.Contains(directoryManager) && !permissionIds.Contains(directoryUser)) + { + _logger.LogError("Employee {EmployeeId} attemped to create a bucket, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); if (existingBucket != null) { -- 2.43.0 From fb3932fe25318ee1ceb3664ee7eb7d986bd0fcb9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:37:24 +0530 Subject: [PATCH 153/469] Enhancement #381: Update "Update Bucket" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 4 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 29 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 680a708..cfc9ed8 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -284,6 +284,10 @@ namespace Marco.Pms.Services.Controllers { return NotFound(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 2b1604d..760ae61 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1088,12 +1088,39 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (bucketDto != null && id == bucketDto.Id) { - var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var bucketIds = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToListAsync(); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) { _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); } + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + bucket.Name = bucketDto.Name ?? ""; bucket.Description = bucketDto.Description ?? ""; -- 2.43.0 From c4050232f2c30aa86a307901618e4265c662246d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 16:29:42 +0530 Subject: [PATCH 154/469] Implement API to Assign Bucket to Employees --- .../Dtos/Directory/AssignBucketDto.cs | 8 ++ Marco.Pms.Model/Mapper/DirectoryMapper.cs | 9 ++ .../ViewModels/Directory/AssignBucketVM.cs | 10 ++ .../Controllers/DirectoryController.cs | 24 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 116 +++++++++++++++++- 5 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs diff --git a/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs new file mode 100644 index 0000000..f675cf3 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class AssignBucketDto + { + public Guid EmployeeId { get; set; } + public bool IsActive { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..2aea3c0 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -202,6 +202,15 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) + { + return new AssignBucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } //Contact Note public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs new file mode 100644 index 0000000..f4c8e2b --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class AssignBucketVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public List? EmployeeIds { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index cfc9ed8..192143d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -177,7 +177,7 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("note/{ContactId}")] + [HttpGet("notes/{ContactId}")] public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { var response = await _directoryHelper.GetNoteListByContactId(contactId, active); @@ -293,5 +293,27 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } + + [HttpPost("assign-bucket/{bucketId}")] + public async Task AssignBucket(Guid bucketId, [FromBody] List assignBuckets) + { + var response = await _directoryHelper.AssignBucket(bucketId, assignBuckets); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 760ae61..4b16d52 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1023,15 +1023,21 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); } - List bucketVMs = new List(); + List bucketVMs = new List(); if (bucketList.Any()) { foreach (var bucket in bucketList) { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + bucketVM.EmployeeIds = emplyeeIds; + bucketVMs.Add(bucketVM); } } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); } @@ -1090,7 +1096,8 @@ namespace Marco.Pms.Services.Helpers { var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - var bucketIds = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToListAsync(); + var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); if (bucket == null) @@ -1133,13 +1140,114 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + bucketVM.EmployeeIds = employeeIds; + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); } _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> AssignBucket(Guid bucketId, List assignBuckets) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (assignBuckets != null && bucketId != Guid.Empty) + { + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); + + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(bucketId)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + var employeeIds = await _context.Employees.Where(e => e.TenantId == tenantId && e.IsActive).Select(e => e.Id).ToListAsync(); + int assignedEmployee = 0; + int removededEmployee = 0; + foreach (var assignBucket in assignBuckets) + { + if (employeeIds.Contains(assignBucket.EmployeeId)) + { + if (assignBucket.IsActive) + { + EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping + { + EmployeeId = assignBucket.EmployeeId, + BucketId = bucketId + }; + _context.EmployeeBucketMappings.Add(employeeBucketMapping); + assignedEmployee += 1; + } + else + { + EmployeeBucketMapping? employeeBucketMapping = employeeBuckets.FirstOrDefault(eb => eb.BucketId == bucketId && eb.EmployeeId == assignBucket.EmployeeId); + if (employeeBucketMapping != null) + { + _context.EmployeeBucketMappings.Remove(employeeBucketMapping); + removededEmployee += 1; + } + } + } + } + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketId, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); + employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + bucketVM.EmployeeIds = employeeIds; + + + if (assignedEmployee > 0) + { + _logger.LogInfo("Employee {EmployeeId} assigned bucket {BucketId} to {conut} number of employees", LoggedInEmployee.Id, bucketId, assignedEmployee); + } + if (removededEmployee > 0) + { + _logger.LogError("Employee {EmployeeId} removed {conut} number of employees from bucket {BucketId}", LoggedInEmployee.Id, removededEmployee, bucketId); + } + return ApiResponse.SuccessResponse(bucketVM, "Details updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From ae51422079313225ffea51bd87ea73b752351eb1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 10:40:00 +0530 Subject: [PATCH 155/469] Implemented an API to delete a Bucket --- .../Controllers/AttendanceController.cs | 4 +- .../Controllers/DirectoryController.cs | 30 ++++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 78 +++++++++++++++++-- 3 files changed, 101 insertions(+), 11 deletions(-) diff --git a/Marco.Pms.Services/Controllers/AttendanceController.cs b/Marco.Pms.Services/Controllers/AttendanceController.cs index 73fe2f5..e6b5804 100644 --- a/Marco.Pms.Services/Controllers/AttendanceController.cs +++ b/Marco.Pms.Services/Controllers/AttendanceController.cs @@ -137,12 +137,12 @@ namespace MarcoBMS.Services.Controllers if (dateFrom != null && DateTime.TryParse(dateFrom, out fromDate) == false) { - _logger.LogError("User sent Invalid from Date while featching attendance logs"); + _logger.LogError("User sent Invalid fromDate while featching attendance logs"); return BadRequest(ApiResponse.ErrorResponse("Invalid Date", "Invalid Date", 400)); } if (dateTo != null && DateTime.TryParse(dateTo, out toDate) == false) { - _logger.LogError("User sent Invalid to Date while featching attendance logs"); + _logger.LogError("User sent Invalid toDate while featching attendance logs"); return BadRequest(ApiResponse.ErrorResponse("Invalid Date", "Invalid Date", 400)); } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 192143d..2bf22ea 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -139,9 +139,9 @@ namespace Marco.Pms.Services.Controllers } [HttpDelete("{id}")] - public async Task DeleteContact(Guid id) + public async Task DeleteContact(Guid id, [FromQuery] bool? active) { - var response = await _directoryHelper.DeleteContact(id); + var response = await _directoryHelper.DeleteContact(id, active ?? false); if (response.StatusCode == 200) { return Ok(response); @@ -214,9 +214,9 @@ namespace Marco.Pms.Services.Controllers } [HttpDelete("note/{id}")] - public async Task DeleteContactNote(Guid id) + public async Task DeleteContactNote(Guid id, [FromQuery] bool? active) { - var response = await _directoryHelper.DeleteContactNote(id); + var response = await _directoryHelper.DeleteContactNote(id, active ?? false); return Ok(response); } @@ -315,5 +315,27 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } + + [HttpDelete("bucket/{id}")] + public async Task DeleteBucket(Guid id) + { + var response = await _directoryHelper.DeleteBucket(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4b16d52..ee96684 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -862,7 +862,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } - public async Task> DeleteContact(Guid id) + public async Task> DeleteContact(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -874,7 +874,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - contact.IsActive = false; + contact.IsActive = active; _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog { @@ -900,7 +900,15 @@ namespace Marco.Pms.Services.Helpers Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); + List notes = new List(); + if (active) + { + notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive && n.TenantId == tenantId).ToListAsync(); + } + else + { + notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); + } List? noteVMs = new List(); foreach (var note in notes) { @@ -973,7 +981,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> DeleteContactNote(Guid id) + public async Task> DeleteContactNote(Guid id, bool active) { Guid tenentId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -981,7 +989,7 @@ namespace Marco.Pms.Services.Helpers ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); if (note != null) { - note.IsActive = false; + note.IsActive = active; _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog { RefereanceId = id, @@ -1248,6 +1256,66 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteBucket(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + + if (bucket != null) + { + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + + if (contactBuckets.Any()) + { + _logger.LogInfo("Employee {EmployeeId} attempted to deleted bucket {BucketId},but bucket have contacts in it.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("This bucket can not be deleted", "This bucket can not be deleted", 400); + } + + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + + _context.EmployeeBucketMappings.RemoveRange(employeeBuckets); + _context.Buckets.Remove(bucket); + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 72fc8bd0d6c8f78c8efccd2811147f940a9b4afb Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 10:45:03 +0530 Subject: [PATCH 156/469] Corrected Spelling mistakes --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ee96684..5c784bc 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -983,10 +983,10 @@ namespace Marco.Pms.Services.Helpers } public async Task> DeleteContactNote(Guid id, bool active) { - Guid tenentId = _userHelper.GetTenantId(); + Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); if (note != null) { note.IsActive = active; @@ -1258,10 +1258,10 @@ namespace Marco.Pms.Services.Helpers } public async Task> DeleteBucket(Guid id) { - Guid tenentId = _userHelper.GetTenantId(); + Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); if (bucket != null) { @@ -1310,7 +1310,7 @@ namespace Marco.Pms.Services.Helpers }); await _context.SaveChangesAsync(); _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); } _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); -- 2.43.0 From ad34ca12e6417c1e6e5b9c714a8806bed64a5071 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 11:36:40 +0530 Subject: [PATCH 157/469] Sending number of conacts within the bucket with it information in API Update bucket, Assign Bucket, and Get Bucket List --- .../ViewModels/Directory/AssignBucketVM.cs | 1 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs index f4c8e2b..e5c16ab 100644 --- a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -6,5 +6,6 @@ public string? Name { get; set; } public string? Description { get; set; } public List? EmployeeIds { get; set; } + public int NumberOfContacts { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5c784bc..e0ac8b9 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1034,14 +1034,16 @@ namespace Marco.Pms.Services.Helpers List bucketVMs = new List(); if (bucketList.Any()) { + bucketIds = bucketList.Select(b => b.Id).ToList(); + List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); foreach (var bucket in bucketList) { List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); - + List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); bucketVM.EmployeeIds = emplyeeIds; - + bucketVM.NumberOfContacts = contactBuckets.Count; bucketVMs.Add(bucketVM); } } @@ -1150,8 +1152,10 @@ namespace Marco.Pms.Services.Helpers AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); bucketVM.EmployeeIds = employeeIds; + bucketVM.NumberOfContacts = contactBuckets.Count; _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); @@ -1239,9 +1243,10 @@ namespace Marco.Pms.Services.Helpers AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); + List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); bucketVM.EmployeeIds = employeeIds; - + bucketVM.NumberOfContacts = contactBuckets.Count; if (assignedEmployee > 0) { -- 2.43.0 From 2552e4b83dfbaf992a7559114bd1899b25fe1c99 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 12:48:02 +0530 Subject: [PATCH 158/469] Included object consist of basic infromation of employee who created the bucket in View models --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 6 ++++-- Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs | 5 ++++- Marco.Pms.Model/ViewModels/Directory/BucketVM.cs | 5 ++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++----- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2aea3c0..4732542 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -199,7 +199,8 @@ namespace Marco.Pms.Model.Mapper { Id = bucket.Id, Name = bucket.Name, - Description = bucket.Description + Description = bucket.Description, + CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null }; } public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) @@ -208,7 +209,8 @@ namespace Marco.Pms.Model.Mapper { Id = bucket.Id, Name = bucket.Name, - Description = bucket.Description + Description = bucket.Description, + CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null }; } diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs index e5c16ab..1458cfb 100644 --- a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -1,10 +1,13 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class AssignBucketVM { public Guid Id { get; set; } public string? Name { get; set; } public string? Description { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } public List? EmployeeIds { get; set; } public int NumberOfContacts { get; set; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs index ce9ed9e..a266658 100644 --- a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs @@ -1,9 +1,12 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class BucketVM { public Guid Id { get; set; } public string? Name { get; set; } public string? Description { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index e0ac8b9..87d3b8e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1019,11 +1019,11 @@ namespace Marco.Pms.Services.Helpers List bucketList = new List(); if (permissionIds.Contains(directoryAdmin)) { - bucketList = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => b.TenantId == tenantId).ToListAsync(); } else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) { - bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); } else { @@ -1090,7 +1090,7 @@ namespace Marco.Pms.Services.Helpers _context.EmployeeBucketMappings.Add(employeeBucket); await _context.SaveChangesAsync(); - + bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucket.Id) ?? new Bucket(); BucketVM bucketVM = bucket.ToBucketVMFromBucket(); _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); @@ -1108,7 +1108,7 @@ namespace Marco.Pms.Services.Helpers var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); if (bucket == null) { @@ -1172,7 +1172,7 @@ namespace Marco.Pms.Services.Helpers var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); + Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); if (bucket == null) { -- 2.43.0 From 55e8ace430fca48de8ce488aad7159ca204ad9e9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:00:56 +0530 Subject: [PATCH 159/469] Sending last updatedBy and updatedAt when sending list of notes --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 87d3b8e..b71c5fc 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -909,11 +909,25 @@ namespace Marco.Pms.Services.Helpers { notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); } + var noteIds = notes.Select(n => n.Id).ToList(); + List? updateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.RefereanceId)).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + DirectoryUpdateLog? updateLog = updateLogs.Where(l => l.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + if (updateLog != null) + { + noteVM.UpdatedAt = updateLog.UpdateAt; + noteVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + else + { + noteVM.UpdatedAt = note.CreatedAt; + noteVM.UpdatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null; + } noteVMs.Add(noteVM); + } _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); -- 2.43.0 From 591b54c90159b330c0b6fe87adb049c4b37cb160 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:14:31 +0530 Subject: [PATCH 160/469] Stopping multiple entries in employee-bucket mapping table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b71c5fc..b02d26b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1195,7 +1195,7 @@ namespace Marco.Pms.Services.Helpers } var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - + var employeeBucketIds = employeeBuckets.Select(eb => eb.EmployeeId).ToList(); Bucket? accessableBucket = null; if (permissionIds.Contains(directoryAdmin)) { @@ -1224,7 +1224,7 @@ namespace Marco.Pms.Services.Helpers { if (employeeIds.Contains(assignBucket.EmployeeId)) { - if (assignBucket.IsActive) + if (assignBucket.IsActive && !employeeBucketIds.Contains(assignBucket.EmployeeId)) { EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping { -- 2.43.0 From a64e9538e40d0df7df97116cb10d25fc7a80c9d6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:55:00 +0530 Subject: [PATCH 161/469] fixed the bug of only sending ID of logged in employee in Bucket object --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b02d26b..9fe4e3f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1029,7 +1029,7 @@ namespace Marco.Pms.Services.Helpers List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - + List employeeBucketVM = await _context.EmployeeBucketMappings.Where(b => bucketIds.Contains(b.BucketId)).ToListAsync(); List bucketList = new List(); if (permissionIds.Contains(directoryAdmin)) { @@ -1052,7 +1052,7 @@ namespace Marco.Pms.Services.Helpers List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); foreach (var bucket in bucketList) { - List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + List employeeBucketMappings = employeeBucketVM.Where(eb => eb.BucketId == bucket.Id).ToList(); var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); -- 2.43.0 From 5ad2a795b8a029ea4ccfbd835a40a32ec378bc67 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 29 May 2025 11:49:08 +0530 Subject: [PATCH 162/469] Sending Is Active in Object Of Contact notes --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 ++- Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs | 1 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 4732542..381c4b0 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -234,7 +234,8 @@ namespace Marco.Pms.Model.Mapper Note = note.Note, ContactId = note.ContactId, CreatedAt = note.CreatedAt, - CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null + CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null, + IsActive = note.IsActive }; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs index c3ca209..c00b0de 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -11,5 +11,6 @@ namespace Marco.Pms.Model.ViewModels.Directory public DateTime? UpdatedAt { get; set; } public BasicEmployeeVM? UpdatedBy { get; set; } public Guid ContactId { get; set; } + public bool IsActive { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9fe4e3f..d34b0d3 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -831,7 +831,7 @@ namespace Marco.Pms.Services.Helpers if (notes.Any()) { List? noteIds = notes.Select(n => n.Id).ToList(); - List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.Id)).OrderByDescending(l => l.UpdateAt).ToListAsync(); + List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.RefereanceId)).OrderByDescending(l => l.UpdateAt).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { -- 2.43.0 From 2cb283f1cd1168e9b63723653b2551785f2c4c04 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 163/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From c85c6f4df5b1c58cef14dab2c1d75870a51c73d4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 09:51:01 +0000 Subject: [PATCH 164/469] revert c7e89630eb494454c1322bdf4cf29ab076af7b86 revert Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 -- Marco.Pms.Model/Directory/Contact.cs | 31 --- .../Directory/ContactBucketMapping.cs | 18 -- .../Directory/ContactCategoryMaster.cs | 11 -- Marco.Pms.Model/Directory/ContactEmail.cs | 21 --- Marco.Pms.Model/Directory/ContactNote.cs | 25 --- Marco.Pms.Model/Directory/ContactPhone.cs | 22 --- .../Directory/ContactTagMapping.cs | 11 -- Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 -- .../Directory/DirectoryUpdateLog.cs | 18 -- .../Directory/EmployeeBucketMapping.cs | 19 -- .../Dtos/Directory/CreateBucketDto.cs | 8 - .../Dtos/Directory/CreateContactDto.cs | 15 -- .../Dtos/Directory/CreateContactEmailDto.cs | 9 - .../Dtos/Directory/CreateContactNoteDto.cs | 8 - .../Dtos/Directory/CreateContactPhoneDto.cs | 9 - .../Dtos/Directory/UpdateContactDto.cs | 16 -- .../Dtos/Directory/UpdateContactEmailDto.cs | 10 - .../Dtos/Directory/UpdateContactNoteDto.cs | 9 - .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 - .../Dtos/Master/CreateContactCategoryDto.cs | 8 - .../Dtos/Master/CreateContactTagDto.cs | 7 - .../Dtos/Master/UpdateContactCategoryDto.cs | 9 - .../Dtos/Master/UpdateContactTagDto.cs | 8 - Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ------------------ .../ViewModels/Directory/ContactEmailVM.cs | 10 - .../ViewModels/Directory/ContactPhoneVM.cs | 10 - .../ViewModels/Directory/ContactVM.cs | 18 -- .../ViewModels/Master/ContactCategoryVM.cs | 9 - .../ViewModels/Master/ContactTagVM.cs | 8 - 30 files changed, 556 deletions(-) delete mode 100644 Marco.Pms.Model/Directory/Bucket.cs delete mode 100644 Marco.Pms.Model/Directory/Contact.cs delete mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs delete mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs delete mode 100644 Marco.Pms.Model/Directory/ContactNote.cs delete mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs delete mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs delete mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs deleted file mode 100644 index 028b428..0000000 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class Bucket : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs deleted file mode 100644 index 87d7698..0000000 --- a/Marco.Pms.Model/Directory/Contact.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class Contact : TenantRelation - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - public string Organization { get; set; } = string.Empty; - public string? Address { get; set; } - public bool IsActive { get; set; } = true; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - - [DisplayName("ContactCategoryId")] - public Guid? ContactCategoryId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactCategoryId))] - public ContactCategoryMaster? ContactCategory { get; set; } - public DateTime CreatedAt { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs deleted file mode 100644 index 9444337..0000000 --- a/Marco.Pms.Model/Directory/ContactBucketMapping.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs deleted file mode 100644 index 8fb1a94..0000000 --- a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactCategoryMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs deleted file mode 100644 index 1eb1b34..0000000 --- a/Marco.Pms.Model/Directory/ContactEmail.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactEmail - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string EmailAddress { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs deleted file mode 100644 index e203f1d..0000000 --- a/Marco.Pms.Model/Directory/ContactNote.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactNote : TenantRelation - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? Createdby { get; set; } - public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - public Guid ContactId { get; set; } - - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs deleted file mode 100644 index d10439b..0000000 --- a/Marco.Pms.Model/Directory/ContactPhone.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactPhone - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string PhoneNumber { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs deleted file mode 100644 index a3d7e9e..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMapping - { - public Guid Id { get; set; } - public Guid ContactId { get; set; } - public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } - public ContactTagMaster? ContactTag { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs deleted file mode 100644 index 86eba76..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs deleted file mode 100644 index 91b1b7a..0000000 --- a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class DirectoryUpdateLog - { - public Guid Id { get; set; } - public Guid RefereanceId { get; set; } - public DateTime UpdateAt { get; set; } = DateTime.UtcNow; - public Guid UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs deleted file mode 100644 index db12d3f..0000000 --- a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class EmployeeBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid EmployeeId { get; set; } - [ValidateNever] - [ForeignKey("EmployeeId")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs deleted file mode 100644 index ba0918d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateBucketDto - { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs deleted file mode 100644 index 42937c0..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactDto - { - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs deleted file mode 100644 index 68bb2b2..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactEmailDto - { - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs deleted file mode 100644 index 1ccaea9..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactNoteDto - { - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs deleted file mode 100644 index dc97881..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactPhoneDto - { - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs deleted file mode 100644 index 042150d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactDto - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs deleted file mode 100644 index 8ece036..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactEmailDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs deleted file mode 100644 index 295357a..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactNoteDto - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs deleted file mode 100644 index 1ddfb14..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactPhoneDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs deleted file mode 100644 index 3efc443..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactCategoryDto - { - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs deleted file mode 100644 index ad91ca7..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactTagDto - { - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs deleted file mode 100644 index 0bd5cc7..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactCategoryDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs deleted file mode 100644 index 0406a6c..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactTagDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs deleted file mode 100644 index 048a0d2..0000000 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ /dev/null @@ -1,177 +0,0 @@ -using Marco.Pms.Model.Directory; -using Marco.Pms.Model.Dtos.Directory; -using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.ViewModels.Directory; -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.Mapper -{ - public static class DirectoryMapper - { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) - { - - return new Contact - { - ProjectId = createContactDto.ProjectId, - Name = createContactDto.Name ?? string.Empty, - ContactCategoryId = createContactDto.ContactCategoryId, - Description = createContactDto.Description ?? string.Empty, - Organization = createContactDto?.Organization ?? string.Empty, - Address = createContactDto != null ? createContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) - { - - return new Contact - { - Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, - Name = updateContactDto.Name ?? string.Empty, - ContactCategoryId = updateContactDto.ContactCategoryId, - Description = updateContactDto.Description ?? string.Empty, - Organization = updateContactDto?.Organization ?? string.Empty, - Address = updateContactDto != null ? updateContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static ContactVM ToContactVMFromContact(this Contact contact) - { - return new ContactVM - { - Id = contact.Id, - ProjectId = contact.ProjectId, - Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), - Description = contact.Description ?? string.Empty, - Organization = contact.Organization ?? string.Empty, - Address = contact.Address ?? string.Empty - }; - } - - //Contact Phone Mapper - public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Label = createContactPhoneDto.Label ?? string.Empty, - PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Id = updateContactPhoneDto.Id, - Label = updateContactPhoneDto.Label ?? string.Empty, - PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) - { - return new ContactPhoneVM - { - Id = phone.Id, - Label = phone.Label ?? string.Empty, - PhoneNumber = phone.PhoneNumber ?? string.Empty, - ContactId = phone.ContactId - }; - } - - //Contact Email Mapper - public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Label = createContactEmailDto.Label ?? string.Empty, - EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Id = updateContactEmailDto.Id, - Label = updateContactEmailDto.Label ?? string.Empty, - EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) - { - return new ContactEmailVM - { - Id = email.Id, - Label = email.Label ?? string.Empty, - EmailAddress = email.EmailAddress ?? string.Empty, - ContactId = email.ContactId - }; - } - - //Contact Tag Mapper - public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Name = createContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Id = updateContactTagDto.Id, - Name = updateContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) - { - return new ContactTagVM - { - Id = contactTag.Id, - Name = contactTag.Name ?? string.Empty, - }; - } - - //Contact Category Mapper - public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Name = createContactTypeDto.Name ?? string.Empty, - Description = createContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Id = updateContactTypeDto.Id, - Name = updateContactTypeDto.Name ?? string.Empty, - Description = updateContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) - { - return new ContactCategoryVM - { - Id = contactType.Id, - Name = contactType.Name ?? string.Empty, - Description = contactType.Description ?? string.Empty, - }; - } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs deleted file mode 100644 index 476e44d..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactEmailVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs deleted file mode 100644 index 1dc7672..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactPhoneVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs deleted file mode 100644 index 6d6f82e..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactVM - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? Tags { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs deleted file mode 100644 index eb08d89..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactCategoryVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs deleted file mode 100644 index 2cb6f8a..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactTagVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} -- 2.43.0 From 260ea2214d5d85d06d68bfcae5e502d7243eded7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:27:36 +0530 Subject: [PATCH 165/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From ba486cffd8ac01e3a461d05a4f7fe021b193eed6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:38:47 +0530 Subject: [PATCH 166/469] Added Directory controller file --- Marco.Pms.Services/Controllers/DirectoryController.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Marco.Pms.Services/Controllers/DirectoryController.cs diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs new file mode 100644 index 0000000..77a183c --- /dev/null +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Marco.Pms.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class DirectoryController : ControllerBase + { + } +} -- 2.43.0 From 07bec9797381a991530b57007fae8a25b2b7cc96 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:44:30 +0530 Subject: [PATCH 167/469] An API skeleton has been added. --- .../Controllers/DirectoryController.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 77a183c..b0de798 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,4 +1,8 @@ -using Microsoft.AspNetCore.Mvc; +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Dtos.Directory; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { @@ -6,5 +10,32 @@ namespace Marco.Pms.Services.Controllers [ApiController] public class DirectoryController : ControllerBase { + + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + + [HttpGet] + public async Task GetContactList() + { + return Ok(); + } + + [HttpPost] + public async Task CreateContact([FromBody] CreateContactDto createContact) + { + return Ok(); + } + { + return Ok(); } } +} -- 2.43.0 From bb8c314723df223c47f20008be79c55e354031aa Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 16:10:07 +0530 Subject: [PATCH 168/469] Added Migration for contact related tables --- .../Data/ApplicationDbContext.cs | 13 + ...Added_Directory_Related_Tables.Designer.cs | 2990 +++++++++++++++++ ...14103249_Added_Directory_Related_Tables.cs | 440 +++ .../ApplicationDbContextModelSnapshot.cs | 479 +++ Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- 5 files changed, 3923 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index a366156..0487d93 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -2,6 +2,7 @@ using Marco.Pms.Model.Activities; using Marco.Pms.Model.AttendanceModule; using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.DocumentManager; using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; @@ -67,6 +68,18 @@ namespace Marco.Pms.DataAccess.Data public DbSet Documents { get; set; } public DbSet TicketTags { get; set; } public DbSet WorkCategoryMasters { get; set; } + public DbSet Contacts { get; set; } + public DbSet ContactCategoryMasters { get; set; } + public DbSet ContactsEmails { get; set; } + public DbSet ContactsPhones { get; set; } + public DbSet ContactNotes { get; set; } + public DbSet Buckets { get; set; } + public DbSet ContactTagMasters { get; set; } + public DbSet ContactTagMappings { get; set; } + public DbSet EmployeeBucketMappings { get; set; } + public DbSet ContactBucketMappings { get; set; } + public DbSet DirectoryUpdateLogs { get; set; } + public DbSet MailingList { get; set; } public DbSet MailDetails { get; set; } public DbSet MailLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs new file mode 100644 index 0000000..f50346e --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -0,0 +1,2990 @@ +// +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("20250514103249_Added_Directory_Related_Tables")] + partial class Added_Directory_Related_Tables + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs new file mode 100644 index 0000000..879f54b --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -0,0 +1,440 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_Directory_Related_Tables : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Buckets", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Buckets", x => x.Id); + table.ForeignKey( + name: "FK_Buckets_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactCategoryMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactCategoryMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactCategoryMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "DirectoryUpdateLogs", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + RefereanceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + UpdateAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_DirectoryUpdateLogs", x => x.Id); + table.ForeignKey( + name: "FK_DirectoryUpdateLogs_Employees_UpdatedById", + column: x => x.UpdatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "EmployeeBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_EmployeeBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Contacts", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: true, 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"), + Organization = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Address = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactCategoryId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Contacts", x => x.Id); + table.ForeignKey( + name: "FK_Contacts_ContactCategoryMasters_ContactCategoryId", + column: x => x.ContactCategoryId, + principalTable: "ContactCategoryMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Contacts_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contacts_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactBucketMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactNotes", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactNotes", x => x.Id); + table.ForeignKey( + name: "FK_ContactNotes_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsEmails", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmailAddress = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsEmails", x => x.Id); + table.ForeignKey( + name: "FK_ContactsEmails_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsPhones", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsPhones", x => x.Id); + table.ForeignKey( + name: "FK_ContactsPhones_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + column: x => x.ContactTagId, + principalTable: "ContactTagMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ContactTagMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_TenantId", + table: "Buckets", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_BucketId", + table: "ContactBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_ContactId", + table: "ContactBucketMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactCategoryMasters_TenantId", + table: "ContactCategoryMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_ContactId", + table: "ContactNotes", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_CreatedById", + table: "ContactNotes", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_TenantId", + table: "ContactNotes", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_ContactCategoryId", + table: "Contacts", + column: "ContactCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_CreatedById", + table: "Contacts", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_TenantId", + table: "Contacts", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsEmails_ContactId", + table: "ContactsEmails", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsPhones_ContactId", + table: "ContactsPhones", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactId", + table: "ContactTagMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMasters_TenantId", + table: "ContactTagMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DirectoryUpdateLogs_UpdatedById", + table: "DirectoryUpdateLogs", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_BucketId", + table: "EmployeeBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_EmployeeId", + table: "EmployeeBucketMappings", + column: "EmployeeId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactNotes"); + + migrationBuilder.DropTable( + name: "ContactsEmails"); + + migrationBuilder.DropTable( + name: "ContactsPhones"); + + migrationBuilder.DropTable( + name: "ContactTagMappings"); + + migrationBuilder.DropTable( + name: "DirectoryUpdateLogs"); + + migrationBuilder.DropTable( + name: "EmployeeBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactTagMasters"); + + migrationBuilder.DropTable( + name: "Contacts"); + + migrationBuilder.DropTable( + name: "Buckets"); + + migrationBuilder.DropTable( + name: "ContactCategoryMasters"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 75c0f9b..a66cb99 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -263,6 +263,312 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("RefreshTokens"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.Property("Id") @@ -2120,6 +2426,179 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("User"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 048a0d2..d66615a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty -- 2.43.0 From bba751256e7f9fe90a1ef10b3916030123abeeee Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 17:51:57 +0530 Subject: [PATCH 169/469] Added DirectoryHelper in helper folder --- .../Dtos/Directory/CreateContactDto.cs | 3 +- .../Dtos/Directory/UpdateContactDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 ++- .../Controllers/DirectoryController.cs | 34 ++++++++++++------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 21 ++++++++++++ Marco.Pms.Services/Program.cs | 2 ++ 6 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 Marco.Pms.Services/Helpers/DirectoryHelper.cs diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 42937c0..6e962a4 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -6,7 +6,8 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } + public List? BucketIds { get; set; } + public Guid? ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 042150d..7c93cce 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -7,6 +7,7 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } + public List? BucketIds { get; set; } public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index d66615a..abf72d3 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -8,7 +8,7 @@ namespace Marco.Pms.Model.Mapper { public static class DirectoryMapper { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId, Guid employeeId) { return new Contact @@ -19,6 +19,8 @@ namespace Marco.Pms.Model.Mapper Description = createContactDto.Description ?? string.Empty, Organization = createContactDto?.Organization ?? string.Empty, Address = createContactDto != null ? createContactDto.Address : string.Empty, + CreatedById = employeeId, + CreatedAt = DateTime.UtcNow, TenantId = tenantId }; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b0de798..a2f984c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,26 +1,25 @@ -using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Dtos.Directory; -using MarcoBMS.Services.Helpers; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { - [Route("api/[controller]")] [ApiController] + [Route("api/[controller]")] + public class DirectoryController : ControllerBase { - private readonly ApplicationDbContext _context; + private readonly DirectoryHelper _directoryHelper; private readonly ILoggingService _logger; - private readonly UserHelper _userHelper; - public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + public DirectoryController(DirectoryHelper directoryHelper, ILoggingService logger) { - _context = context; + _directoryHelper = directoryHelper; _logger = logger; - _userHelper = userHelper; } [HttpGet] @@ -32,10 +31,21 @@ namespace Marco.Pms.Services.Controllers [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + return Ok(); } - { - return Ok(); + + + + } } -} diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs new file mode 100644 index 0000000..832d190 --- /dev/null +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -0,0 +1,21 @@ +using Marco.Pms.DataAccess.Data; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; + +namespace Marco.Pms.Services.Helpers +{ + public class DirectoryHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index ff4cca8..86eb297 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -3,6 +3,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Authentication; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using Marco.Pms.Services.Service; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Middleware; @@ -130,6 +131,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From 40c0bcd3cabfdc238ca708da73ecd41aa501cd26 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 170/469] created GetListOfContact custome function --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../ViewModels/Directory/ContactVM.cs | 2 +- .../Controllers/DirectoryController.cs | 13 ++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 92 ++++++++++++++++++- 4 files changed, 105 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index abf72d3..fbe0e46 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index 6d6f82e..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.ViewModels.Directory public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a2f984c..efa76c3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,7 +25,18 @@ namespace Marco.Pms.Services.Controllers [HttpGet] public async Task GetContactList() { - return Ok(); + var response = await _directoryHelper.GetListOfContacts(); + + + if(response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 832d190..5e11587 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,6 +1,12 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; namespace Marco.Pms.Services.Helpers { @@ -17,5 +23,89 @@ namespace Marco.Pms.Services.Helpers _logger = logger; _userHelper = userHelper; } + + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + + List contactIds = contacts.Select(c=>c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); + + var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); + + + List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if(emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if(phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + + if (tagMappingss != null) { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag.ToContactTagVMFromContactTagMaster(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + + return ApiResponse.SuccessResponse(list, "Contact List !",200); + + } } -} + } -- 2.43.0 From a8b935946a8d98bead62e8ac0cdb06270ed0f909 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 171/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 2 +- .../Dtos/Directory/CreateContactPhoneDto.cs | 1 - .../Controllers/DirectoryController.cs | 11 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 110 ++++++++++++++++++ 4 files changed, 120 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 68bb2b2..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,6 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } } } + diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index dc97881..a72ac3d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,6 +4,5 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index efa76c3..afcb061 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -51,8 +51,15 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("User sent Invalid Date while marking attendance"); return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); } - - return Ok(); + var response = await _directoryHelper.CreateContact(createContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5e11587..b1f6e9c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,5 +1,6 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; @@ -107,5 +108,114 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, "Contact List !",200); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } -- 2.43.0 From c2bdf76957031a92cbb91235377bf407f9a407e2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 172/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 84 ------------------- 1 file changed, 84 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b1f6e9c..7ac80c4 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -25,90 +25,6 @@ namespace Marco.Pms.Services.Helpers _userHelper = userHelper; } - - - public async Task> GetListOfContacts() - { - Guid tenantId = _userHelper.GetTenantId(); - - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - - List contactIds = contacts.Select(c=>c.Id).ToList(); - - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - - var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); - - var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); - - - List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); - - var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); - - List list = new List(); - - foreach (var contact in contacts) - { - - ContactVM contactVM = new ContactVM(); - List contactEmailVms = new List(); - List contactPhoneVms = new List(); - - List conatctTagVms = new List(); - var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); - var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); - var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - - - if(emails != null) - { - foreach (var email in emails) - { - ContactEmailVM emailVM = new ContactEmailVM(); - emailVM = email.ToContactEmailVMFromContactEmail(); - contactEmailVms.Add(emailVM); - } - } - - if(phones != null) - { - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = new ContactPhoneVM(); - phoneVM = phone.ToContactPhoneVMFromContactPhone(); - contactPhoneVms.Add(phoneVM); - } - - } - - if (tagMappingss != null) { - foreach (var tagMapping in tagMappingss) - { - ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); - - tagVM = tag.ToContactTagVMFromContactTagMaster(); - conatctTagVms.Add(tagVM); - - - } - } - - - contactVM = contact.ToContactVMFromContact(); - - contactVM.ContactEmails = contactEmailVms; - contactVM.ContactPhones = contactPhoneVms; - contactVM.Tags = conatctTagVms; - - list.Add(contactVM); - } - - return ApiResponse.SuccessResponse(list, "Contact List !",200); - - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 66b8a748731254867d18dea223f94d13ed8df5aa Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 173/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../Controllers/DirectoryController.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 81 ++++++++++++++++++- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index fbe0e46..b9e9f86 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index afcb061..b5ac7e5 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -2,12 +2,14 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { [ApiController] [Route("api/[controller]")] + [Authorize] public class DirectoryController : ControllerBase { @@ -28,7 +30,7 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetListOfContacts(); - if(response.StatusCode == 200) + if (response.StatusCode == 200) { return Ok(response); } @@ -36,7 +38,7 @@ namespace Marco.Pms.Services.Controllers { return BadRequest(response); } - + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 7ac80c4..c34d2ac 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -25,6 +25,85 @@ namespace Marco.Pms.Services.Helpers _userHelper = userHelper; } + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); + var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if (emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if (phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + if (tagMappingss != null) + { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + _logger.LogInfo("{count} contacts are fetched by Employee with ID {LoggedInEmployeeId}", list.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); + + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -134,4 +213,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From 783c6576deee2dbd70521105083fcf0ef20da59b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 12:51:23 +0530 Subject: [PATCH 174/469] Created an API to create the Contact category --- .../Dtos/Master/CreateContactTagDto.cs | 1 + .../Dtos/Master/UpdateContactTagDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Master/ContactTagVM.cs | 1 + .../Controllers/MasterController.cs | 81 ++++++++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 54 +++++++++++++ Marco.Pms.Services/Program.cs | 1 + 7 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Services/Helpers/MasterHelper.cs diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs index ad91ca7..2fec4ae 100644 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -3,5 +3,6 @@ public class CreateContactTagDto { public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs index 0406a6c..e97ece6 100644 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b9e9f86..82e703f 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -125,6 +125,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagMaster { Name = createContactTagDto.Name ?? string.Empty, + Description = createContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -134,6 +135,7 @@ namespace Marco.Pms.Model.Mapper { Id = updateContactTagDto.Id, Name = updateContactTagDto.Name ?? string.Empty, + Description = updateContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -142,6 +144,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagVM { Id = contactTag.Id, + Description = contactTag.Description ?? string.Empty, Name = contactTag.Name ?? string.Empty, }; } diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs index 2cb6f8a..321b669 100644 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index b89dc91..0d0221b 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -9,6 +9,7 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Activities; using Marco.Pms.Model.ViewModels.Forum; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Authorization; @@ -25,11 +26,13 @@ namespace Marco.Pms.Services.Controllers private readonly ApplicationDbContext _context; private readonly UserHelper _userHelper; private readonly ILoggingService _logger; - public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger) + private readonly MasterHelper _masterHelper; + public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger, MasterHelper masterHelper) { _context = context; _userHelper = userHelper; _logger = logger; + _masterHelper = masterHelper; } // -------------------------------- Activity -------------------------------- @@ -667,5 +670,81 @@ namespace Marco.Pms.Services.Controllers return NotFound(ApiResponse.ErrorResponse("Work category not found", "Work category not found", 404)); } } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-categories")] + public async Task GetContactCategoryMasterList() + { + return Ok(); + } + + [HttpGet("contact-category/{id})")] + public async Task GetContactCategoryMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-category")] + public async Task CreateContactCategoryMaster([FromBody] CreateContactCategoryDto contactCategoryDto) + { + var response = await _masterHelper.CreateContactCategory(contactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPost("contact-category/edit/{id}")] + public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) + { + return Ok(); + } + + [HttpDelete("contact-category/{id}")] + public async Task DeletecontactCategoryMaster(Guid id) + { + return Ok(); + } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-tags")] + public async Task GetContactTagMasterList() + { + return Ok(); + } + + [HttpGet("contact-tag/{id})")] + public async Task GetContactTagMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-tag")] + public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) + { + return Ok(); + } + + [HttpPost("contact-tag/edit/{id}")] + public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) + { + return Ok(); + } + + [HttpDelete("contact-tag/{id}")] + public async Task DeletecontactTagMaster(Guid id) + { + return Ok(); + } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs new file mode 100644 index 0000000..893eee2 --- /dev/null +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -0,0 +1,54 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Master; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; + +namespace Marco.Pms.Services.Helpers +{ + public class MasterHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public MasterHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + // -------------------------------- Contact Category -------------------------------- + public async Task> CreateContactCategory(CreateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactCategoryDto.Name != null ? contactCategoryDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactCategoryMaster contactCategory = contactCategoryDto.ToContactCategoryMasterFromCreateContactCategoryDto(tenantId); + _context.ContactCategoryMasters.Add(contactCategory); + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact category.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category already existed", "Category already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + // -------------------------------- Contact Tag -------------------------------- + // -------------------------------- Bucket -------------------------------- + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index 86eb297..d8adc25 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -132,6 +132,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From 84b1e7de0b7b5dda9eddae1ecd05a442d860131b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 175/469] Created an endpoint to fetch list of all contact category in that tenant --- .../Controllers/MasterController.cs | 5 +++-- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 0d0221b..fe0f1e9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -676,7 +676,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-categories")] public async Task GetContactCategoryMasterList() { - return Ok(); + var response = await _masterHelper.GetContactCategoriesList(); + return Ok(response); } [HttpGet("contact-category/{id})")] @@ -715,7 +716,7 @@ namespace Marco.Pms.Services.Controllers return Ok(); } - // -------------------------------- Contact Category -------------------------------- + // -------------------------------- Contact Tag -------------------------------- [HttpGet("contact-tags")] public async Task GetContactTagMasterList() diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 893eee2..75c6d5f 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -48,6 +48,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- // -------------------------------- Bucket -------------------------------- } -- 2.43.0 From b3d4018c5f100b5d220c6c2063019775df713f0a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 176/469] Added an API to update existing contact --- .../Dtos/Directory/ContactTagDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactEmailDto.cs | 2 +- .../Dtos/Directory/UpdateContactPhoneDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +- .../Controllers/DirectoryController.cs | 18 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 8 files changed, 258 insertions(+), 13 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs new file mode 100644 index 0000000..12b0223 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactTagDto + { + public Guid? Id { get; set; } + public string Name { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 6e962a4..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -11,6 +11,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 7c93cce..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -12,6 +12,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs index 8ece036..186f5b3 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactEmailDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? EmailAddress { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs index 1ddfb14..ff0ec23 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactPhoneDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? PhoneNumber { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 82e703f..9b5c835 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -68,7 +68,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactPhone { - Id = updateContactPhoneDto.Id, + Id = updateContactPhoneDto.Id ?? Guid.Empty, Label = updateContactPhoneDto.Label ?? string.Empty, PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, ContactId = contactId, @@ -101,7 +101,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactEmail { - Id = updateContactEmailDto.Id, + Id = updateContactEmailDto.Id ?? Guid.Empty, Label = updateContactEmailDto.Label ?? string.Empty, EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, ContactId = contactId, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b5ac7e5..fe82bce 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -64,7 +64,23 @@ namespace Marco.Pms.Services.Controllers } } - + [HttpPut("{id}")] + public async Task UpdateContact(Guid id, [FromBody] UpdateContactDto updateContact) + { + var response = await _directoryHelper.UpdateContact(id, updateContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c34d2ac..81f419c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -162,17 +162,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -209,8 +224,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From adc31a69097b861791405aceabf1ee62209755de Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 177/469] added api to get list of contact tag --- .../Controllers/MasterController.cs | 3 ++- Marco.Pms.Services/Helpers/MasterHelper.cs | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index fe0f1e9..4df3a62 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -721,7 +721,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-tags")] public async Task GetContactTagMasterList() { - return Ok(); + var response = await _masterHelper.GetContactTags(); + return Ok(response); } [HttpGet("contact-tag/{id})")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 75c6d5f..ca1bbde 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -65,6 +66,23 @@ namespace Marco.Pms.Services.Helpers } // -------------------------------- Contact Tag -------------------------------- + + + public async Task> GetContactTags() + { + Guid tenantId = _userHelper.GetTenantId(); + + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + List contactTags = new List(); + foreach (var tag in taglist) { + ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); + contactTags.Add(tagVm); + } + _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + } // -------------------------------- Bucket -------------------------------- } } -- 2.43.0 From 684598eb6bfffbed3f8d7b7bc9574a2e55cb05bb Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 178/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 11 ++++++++++ .../ViewModels/Directory/BucketVM.cs | 9 ++++++++ .../Controllers/DirectoryController.cs | 6 +++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/BucketVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 9b5c835..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -178,5 +178,16 @@ namespace Marco.Pms.Model.Mapper Description = contactType.Description ?? string.Empty, }; } + + // Bucket + public static BucketVM ToBucketVMFromBucket(this Bucket bucket) + { + return new BucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs new file mode 100644 index 0000000..ce9ed9e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class BucketVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fe82bce..65ccd2d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -83,5 +83,11 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("buckets")] + public async Task GetBucketList() + { + var response = await _directoryHelper.GetBucketList(); + return Ok(response); + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 81f419c..5d8e0b7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -433,5 +433,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From 7f5f3da5fb33b337e163d0199e95c8ef6790d057 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 179/469] Added an API to create a contact tag --- .../Controllers/MasterController.cs | 23 ++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 34 ++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 4df3a62..8e4a86f 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -734,7 +734,28 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag")] public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) { - return Ok(); + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _masterHelper.CreateContactTag(contactTagDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-tag/edit/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ca1bbde..1906ec2 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -76,13 +75,38 @@ namespace Marco.Pms.Services.Helpers var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); List contactTags = new List(); - foreach (var tag in taglist) { + foreach (var tag in taglist) + { ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); contactTags.Add(tagVm); } _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count), 200); } - // -------------------------------- Bucket -------------------------------- + public async Task> CreateContactTag(CreateContactTagDto contactTagDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); + _context.ContactTagMasters.Add(contactTag); + await _context.SaveChangesAsync(); + ContactTagVM tagVM = contactTag.ToContactTagVMFromContactTagMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact tag {ContactTagId}.", LoggedInEmployee.Id, contactTag.Id); + return ApiResponse.SuccessResponse(tagVM, "Tag Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact tag.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Tag already existed", "Tag already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + } } -- 2.43.0 From 8ab737fe8abd9fd9f9766b297a64b210b59f1284 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:38:24 +0530 Subject: [PATCH 180/469] Fixed the errorof finding tag in wrong table --- Marco.Pms.Services/Helpers/MasterHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 1906ec2..66d3b45 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -89,8 +89,8 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (contactTagDto != null) { - ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); - if (existingContactCategory == null) + ContactTagMaster? existingContactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactTag == null) { ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); _context.ContactTagMasters.Add(contactTag); -- 2.43.0 From 49ddd3ec45ee43587983bcfe2663e35ec310005c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 181/469] Added an API to create bucket --- .../Dtos/Directory/CreateBucketDto.cs | 4 +- .../Controllers/DirectoryController.cs | 28 ++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs index ba0918d..0c02457 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -2,7 +2,7 @@ { public class CreateBucketDto { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 65ccd2d..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -89,5 +89,33 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetBucketList(); return Ok(response); } + + [HttpPost("bucket")] + public async Task CreateBucket(CreateBucketDto bucketDto) + { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _directoryHelper.CreateBucket(bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5d8e0b7..704a0d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -455,5 +455,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From 4b4ebee1a191da7e2cdd37bb076a91dac4f51b3d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 182/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 704a0d0..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -377,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 9247221a9f2d403b61cd8d1c83ac24b461d058da Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 183/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3415 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 0487d93..9975782 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet MailingList { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index a66cb99..b80c716 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2541,6 +2564,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..46d0482 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..aa1ef35 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,6 +41,24 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From de324407d0b88516845d55d09d53d7513a439ec6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 184/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 23 insertions(+), 3415 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 9975782..0487d93 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet MailingList { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index b80c716..a66cb99 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,6 +320,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -475,32 +478,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2564,33 +2541,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -42,6 +44,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index aa1ef35..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,24 +41,6 @@ namespace Marco.Pms.Services.Controllers } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,19 +31,13 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - - List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -61,10 +55,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -74,7 +67,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -84,7 +77,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -97,17 +90,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -119,102 +104,6 @@ namespace Marco.Pms.Services.Helpers } - public async Task> GetContactsListByBucketId(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); - if (employeeBucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); - } - List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); - List contactVMs = new List(); - if (contactBucket.Count > 0) - { - var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); - List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); - List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); - - List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); - List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - - List tagIds = new List(); - List tagMasters = new List(); - if (tags.Count > 0) - { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); - tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - } - - if (contacts.Count > 0) - { - - - foreach (var contact in contacts) - { - List? emailVMs = new List(); - List? phoneVMs = new List(); - List? tagVMs = new List(); - - List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); - List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); - - List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); - List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); - List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); - - if (contactPhones.Count > 0) - { - foreach (var phone in contactPhones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - } - if (contactEmails.Count > 0) - { - foreach (var email in contactEmails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - } - if (contactTags.Count > 0) - { - foreach (var contactTag in contactTags) - { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); - if (tagMaster != null) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - } - } - ContactVM contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = emailVMs; - contactVM.ContactPhones = phoneVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - contactVMs.Add(contactVM); - } - } - - } - _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -234,8 +123,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -258,7 +145,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -274,29 +160,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -314,8 +179,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -326,20 +190,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -365,8 +221,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -385,7 +239,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -405,9 +259,6 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -495,33 +346,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } - if (updateContact.ProjectIds != null) - { - foreach (var ProjectId in updateContact.ProjectIds) - { - if (!projectIds.Contains(ProjectId)) - { - _context.ContactProjectMappings.Add(new ContactProjectMapping - { - ProjectId = ProjectId, - ContactId = contact.Id - }); - } - } - - foreach (var projectMapping in contactProjects) - { - if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) - { - _context.ContactProjectMappings.Remove(projectMapping); - } - } - } - else if (contactProjects != null) - { - _context.ContactProjectMappings.RemoveRange(contactProjects); - } - if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -540,8 +364,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -554,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -576,10 +399,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -608,9 +427,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 922eb7bc0dd507c822f158b43760965eef8edf1f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 185/469] Added an API to delete existing contact category --- .../Controllers/MasterController.cs | 3 +- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 8e4a86f..e782913 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -713,7 +713,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-category/{id}")] public async Task DeletecontactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactCategory(id); + return Ok(response); } // -------------------------------- Contact Tag -------------------------------- diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 66d3b45..33fab6b 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -63,6 +63,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 9709893603a6ce21888b967d98ce5cfd1b09e089 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 186/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...63809_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 17 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3414 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 0487d93..5acbbe2 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -79,6 +79,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet MailingList { get; set; } public DbSet MailDetails { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..18a4be6 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517063809_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index a66cb99..b80c716 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2541,6 +2564,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..bd49e18 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -40,6 +40,23 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 85d7863fb204c02019795a15a5a808f927511e78 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:28:54 +0530 Subject: [PATCH 187/469] Refetched the contact in update contact API --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..ff3f730 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -393,6 +393,7 @@ namespace Marco.Pms.Services.Helpers } var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + _context.Contacts.Update(newContact); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -573,6 +574,7 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From f42ebe3886cad3dc816d9384d1c0cc7ca3e4c52f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 188/469] properly mapped the updated Dto to contact table --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..f78c260 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -23,7 +23,7 @@ namespace Marco.Pms.Model.Mapper TenantId = tenantId }; } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId, Contact contact) { return new Contact @@ -31,6 +31,8 @@ namespace Marco.Pms.Model.Mapper Id = updateContactDto.Id, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, + CreatedAt = contact.CreatedAt, + CreatedById = contact.CreatedById, Description = updateContactDto.Description ?? string.Empty, Organization = updateContactDto?.Organization ?? string.Empty, Address = updateContactDto != null ? updateContactDto.Address : string.Empty, diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ff3f730..f1100c6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -385,15 +385,16 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.AsNoTracking().FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); + await _context.SaveChangesAsync(); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -505,7 +506,8 @@ namespace Marco.Pms.Services.Helpers _context.ContactProjectMappings.Add(new ContactProjectMapping { ProjectId = ProjectId, - ContactId = contact.Id + ContactId = contact.Id, + TenantId = tenantId }); } } @@ -572,7 +574,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From ba38c857a268523a71f027dce942c0e96d637b94 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 189/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f1100c6..d866509 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -36,7 +36,7 @@ namespace Marco.Pms.Services.Helpers List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); @@ -118,7 +118,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -233,6 +232,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); @@ -301,14 +301,14 @@ namespace Marco.Pms.Services.Helpers { foreach (var tag in createContact.Tags) { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) + if (tagNames.Contains(tag.Name.ToLower())) { - ContactTagMapping tagMapping = new ContactTagMapping + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); + _context.ContactTagMappings.Add(new ContactTagMapping { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); + ContactId = contact.Id, + ContactTagtId = tag.Id ?? existingTag.Id + }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) { @@ -373,7 +373,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -407,10 +406,12 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -530,12 +531,13 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + if (tagNames.Contains(tag.Name.ToLower())) { + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id.Value + ContactTagtId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -574,19 +576,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From b9b06ba54c2982f0e7dc198ee155f9cd78f0bc48 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 14:33:14 +0530 Subject: [PATCH 190/469] Added an API to deleted ContactTag as well remove entries in contact-tag mapping table related to that tag --- .../Controllers/MasterController.cs | 7 ++--- Marco.Pms.Services/Helpers/MasterHelper.cs | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index e782913..1ba1ee9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -680,7 +680,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-category/{id})")] + [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { return Ok(); @@ -726,7 +726,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-tag/{id})")] + [HttpGet("contact-tag/{id}")] public async Task GetContactTagMaster(Guid id) { return Ok(); @@ -768,7 +768,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-tag/{id}")] public async Task DeletecontactTagMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactTag(id); + return Ok(response); } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 33fab6b..ac05b97 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -139,7 +139,33 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactTag(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactTag != null) + { + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + _context.ContactTagMasters.Remove(contactTag); + if (tagMappings.Any()) + { + _context.ContactTagMappings.RemoveRange(tagMappings); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact tag {ContactTagId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Tag {ContactTagId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Tag deleted successfully", 200); + } } } -- 2.43.0 From ae20e215db7122e4b80470666035ad78569d74a2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:13:35 +0530 Subject: [PATCH 191/469] added an API to get a list of contact-notes by contact ID --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 22 ++++++ .../ViewModels/Directory/ContactNoteVM.cs | 9 +++ .../Controllers/DirectoryController.cs | 67 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 +++++++ 4 files changed, 121 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index f78c260..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -188,5 +188,27 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + + //Contact Note + public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) + { + return new ContactNote + { + Note = noteDto.Note, + ContactId = noteDto.ContactId, + CreatedAt = DateTime.UtcNow, + CreatedById = employeeId, + TenantId = tenantId + }; + } + public static ContactNoteVM ToContactNoteVMFromContactNote(this ContactNote note) + { + return new ContactNoteVM + { + Id = note.Id, + Note = note.Note, + ContactId = note.ContactId + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs new file mode 100644 index 0000000..5e1c340 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactNoteVM + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index bd49e18..dd3785e 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,73 @@ namespace Marco.Pms.Services.Controllers } } + // -------------------------------- Contact Notes -------------------------------- + + [HttpPost("note")] + public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.CreateContactNote(noteDto); + //if (response.StatusCode == 200) + //{ + //return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpGet("note/{ContactId}")] + public async Task GetNoteListByContactId(Guid contactId) + { + var response = await _directoryHelper.GetNoteListByContactId(contactId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPut("note/{id}")] + public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.UpdateContactNote(id, noteDto); + //if (response.StatusCode == 200) + //{ + // return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpDelete("note/{id}")] + public async Task DeleteContactNote(Guid id) + { + return Ok(); + //var response = await _directoryHelper.DeleteContactNote(id); + //return Ok(response); + } + + // -------------------------------- Bucket -------------------------------- [HttpGet("buckets")] public async Task GetBucketList() diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d866509..b68a854 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -624,6 +624,29 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + // -------------------------------- Contact Notes -------------------------------- + + public async Task> GetNoteListByContactId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + noteVMs.Add(noteVM); + } + _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From f1c6468e47854e4019a7447125f9370c9a04e4d6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 192/469] Added an API to get contact category by its size --- .../Controllers/MasterController.cs | 14 +++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 1ba1ee9..61baaa3 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -683,7 +683,19 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.GetContactCategoryById(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-category")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ac05b97..11015c8 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -47,7 +47,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -63,6 +62,22 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> GetContactCategoryById(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var category = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (category != null) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + _logger.LogInfo("Employee {EmployeeId} fetched contact category {ContactCategoryID}", LoggedInEmployee.Id, category.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category fetched successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} attempted to fetch contact category {ContactCategoryID} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } public async Task> DeleteContactCategory(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From ebc4a1e071f55e962b28d27bfa71c4ca560a2e20 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 193/469] Added an API to Update existing Contact-note --- .../Controllers/DirectoryController.cs | 60 +++++++++---------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 ++++++++++++ 2 files changed, 67 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index dd3785e..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -104,20 +104,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("note")] public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.CreateContactNote(noteDto); - //if (response.StatusCode == 200) - //{ - //return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + + var response = await _directoryHelper.CreateContactNote(noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpGet("note/{ContactId}")] @@ -141,28 +141,26 @@ namespace Marco.Pms.Services.Controllers [HttpPut("note/{id}")] public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.UpdateContactNote(id, noteDto); - //if (response.StatusCode == 200) - //{ - // return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + var response = await _directoryHelper.UpdateContactNote(id, noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("note/{id}")] public async Task DeleteContactNote(Guid id) { - return Ok(); - //var response = await _directoryHelper.DeleteContactNote(id); - //return Ok(response); + var response = await _directoryHelper.DeleteContactNote(id); + return Ok(response); } // -------------------------------- Bucket -------------------------------- diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b68a854..a185a1d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -647,6 +647,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 7660063ac34f441993235d288246e29a4936a473 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 194/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a185a1d..9861a15 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -684,6 +684,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 77306c6bdbba3f120132e0e5486f4c3d554b0a48 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:43 +0530 Subject: [PATCH 195/469] Added an API to add a note to specific contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9861a15..ebaeb4e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -646,7 +646,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - + public async Task> CreateContactNote(CreateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote note = noteDto.ToContactNoteFromCreateContactNoteDto(tenantId, LoggedInEmployee.Id); + _context.ContactNotes.Add(note); + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + _logger.LogInfo("Employee {EmployeeId} Added note at contact {ContactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note added successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to add a note to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From df1408b63a778e797d0e9b1afa895d24ce84a418 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 196/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..12951b9 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -29,6 +29,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, -- 2.43.0 From f7dce83629fc5cd28e5d806bea83f2779131041c Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 197/469] created GetListOfContact custome function --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ebaeb4e..6ee029b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -787,4 +787,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } -} + } -- 2.43.0 From f785003e9b99029e46f5a381cf9d1f80e7881401 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 198/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 6ee029b..e197d31 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -786,5 +786,114 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } -- 2.43.0 From acffebfb90abed20764623db1b216bde93e41510 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 199/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index e197d31..5eeb0bd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -896,4 +896,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From ca561711de0f96458ad6c014959d156e91f1fb5c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 200/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 11015c8..ede969e 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -112,6 +112,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 12a1e1cf278ea826d70d05e3fd232d7151ddd7f0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 201/469] Added an API to update existing contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 1 file changed, 227 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5eeb0bd..ebd5e49 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -845,17 +845,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -892,8 +907,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From 4060d7d1f216b2d6b148c93fe0b1d67527849fed Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 202/469] added api to get list of contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ede969e..ef8f7f0 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; -- 2.43.0 From ec72632004fbf290dc3eca8d08d2cb50f21085f4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 203/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ebd5e49..21c9b4b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1116,5 +1116,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From 3f0d6f26fc299e7f0377e884a43edac608530fb9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 204/469] Added an API to create a contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ef8f7f0..ede969e 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; -- 2.43.0 From c78c9a92b400da2971c5274e2585e4d884843e4a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 205/469] Added an API to create bucket --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 21c9b4b..fa323d1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1138,5 +1138,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From f18b1f8dea667471b389cb8de59dff1a2046531b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 206/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index fa323d1..9dbacff 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1060,7 +1060,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From b4cffbf713cd822705396b470c23a2acd6705b19 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 207/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 - .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 388 --- 7 files changed, 3141 insertions(+), 390 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 5acbbe2..71c4a00 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 12951b9..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -29,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..b368b47 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -58,6 +58,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9dbacff..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -787,393 +787,5 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> CreateContact(CreateContactDto createContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (createContact != null) - { - List phones = new List(); - List emails = new List(); - List contactBucketMappings = new List(); - List contactTagMappings = new List(); - - Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); - - _context.Contacts.Add(contact); - await _context.SaveChangesAsync(); - _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); - - var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); - var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - if (createContact.ContactPhones != null) - { - - foreach (var contactPhone in createContact.ContactPhones) - { - ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); - phones.Add(phone); - } - _context.ContactsPhones.AddRange(phones); - _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.ContactEmails != null) - { - - foreach (var contactEmail in createContact.ContactEmails) - { - ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); - emails.Add(email); - } - _context.ContactsEmails.AddRange(emails); - _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.BucketIds != null) - { - foreach (var bucket in createContact.BucketIds) - { - if (buckets.Contains(bucket)) - { - ContactBucketMapping bucketMapping = new ContactBucketMapping - { - BucketId = bucket, - ContactId = contact.Id - }; - contactBucketMappings.Add(bucketMapping); - } - } - _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); - } - if (createContact.Tags != null) - { - foreach (var tag in createContact.Tags) - { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) - { - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) - { - var newtag = new ContactTagMaster - { - Name = tag.Name - }; - _context.ContactTagMasters.Add(newtag); - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagtId = newtag.Id, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - } - _context.ContactTagMappings.AddRange(contactTagMappings); - } - await _context.SaveChangesAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTagMappings) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - - return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContact != null) - { - if (updateContact.Id != id) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); - } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contact == null) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); - - List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var phoneIds = phones.Select(p => p.Id).ToList(); - List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var emailIds = emails.Select(p => p.Id).ToList(); - - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); - - List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - - if (updateContact.ContactPhones != null) - { - var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); - foreach (var phoneDto in updateContact.ContactPhones) - { - var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); - if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Update(phone); - } - else - { - _context.ContactsPhones.Add(phone); - } - } - foreach (var phone in phones) - { - - if (!updatedPhoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Remove(phone); - } - } - } - else if (phones != null) - { - _context.ContactsPhones.RemoveRange(phones); - } - - if (updateContact.ContactEmails != null) - { - var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); - - foreach (var emailDto in updateContact.ContactEmails) - { - var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); - if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) - { - _context.ContactsEmails.Update(email); - } - else - { - _context.ContactsEmails.Add(email); - } - } - foreach (var email in emails) - { - - if (!updateEmailIds.Contains(email.Id)) - { - _context.ContactsEmails.Remove(email); - } - } - } - else if (emails != null) - { - _context.ContactsEmails.RemoveRange(emails); - } - - if (updateContact.BucketIds != null) - { - foreach (var bucketId in updateContact.BucketIds) - { - if (!bucketIds.Contains(bucketId)) - { - _context.ContactBucketMappings.Add(new ContactBucketMapping - { - BucketId = bucketId, - ContactId = contact.Id - }); - } - } - foreach (var bucketMapping in contactBuckets) - { - if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) - { - _context.ContactBucketMappings.Remove(bucketMapping); - } - } - } - else if (contactBuckets != null) - { - _context.ContactBucketMappings.RemoveRange(contactBuckets); - } - - if (updateContact.Tags != null) - { - var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); - foreach (var tag in updateContact.Tags) - { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) - { - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagtId = tag.Id.Value - }); - } - else if (tag.Id == null || tag.Id == Guid.Empty) - { - ContactTagMaster contactTag = new ContactTagMaster - { - Name = tag.Name, - Description = "" - }; - _context.ContactTagMasters.Add(contactTag); - - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagtId = contactTag.Id - }); - } - } - foreach (var contactTag in contactTags) - { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) - { - _context.ContactTagMappings.Remove(contactTag); - } - } - } - else if (contactTags != null) - { - _context.ContactTagMappings.RemoveRange(contactTags); - } - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contact.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - - phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTags) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - - // -------------------------------- Bucket -------------------------------- - - public async Task> GetBucketList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - - List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); - - List bucketVMs = new List(); - foreach (var bucket in bucketList) - { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); - } - _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); - } - - public async Task> CreateBucket(CreateBucketDto bucketDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (bucketDto != null) - { - var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); - if (existingBucket != null) - { - _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); - } - Bucket bucket = new Bucket - { - Name = bucketDto.Name, - Description = bucketDto.Description, - TenantId = tenantId - }; - _context.Buckets.Add(bucket); - - EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping - { - EmployeeId = LoggedInEmployee.Id, - BucketId = bucket.Id - }; - - _context.EmployeeBucketMappings.Add(employeeBucket); - await _context.SaveChangesAsync(); - - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } } } -- 2.43.0 From cedf3d19b5a738c0005527367ce81c66d42c59f5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 208/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 77 +- 12 files changed, 20 insertions(+), 3285 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 71c4a00..5acbbe2 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index b80c716..a66cb99 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,6 +320,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -475,32 +478,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2564,33 +2541,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..8197c94 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b368b47..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -58,24 +58,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..157c62d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,19 +31,14 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -61,10 +56,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -74,7 +68,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -84,7 +78,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -97,17 +91,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -234,8 +220,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -258,7 +242,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -274,29 +257,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -314,8 +276,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -326,20 +287,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -365,8 +318,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -545,8 +496,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -559,7 +509,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -582,10 +532,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -614,9 +560,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From e6f8cc626be7f9bf370f53747b9d0e486785d3bc Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 209/469] Added an API to delete existing contact category --- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ede969e..a26f401 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -127,6 +127,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 3ab215b4011efeb55811d3f3aa8ddb8b7c6d2023 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 210/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 +++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 77 ++++++++++++++++--- 8 files changed, 145 insertions(+), 20 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index a66cb99..b80c716 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -320,9 +320,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -478,6 +475,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2541,6 +2564,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 8197c94..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 157c62d..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,14 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -56,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -68,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -78,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -91,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -220,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -242,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -257,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -276,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -287,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -318,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -496,7 +545,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -509,7 +559,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -532,6 +582,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -560,6 +614,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From f1e3febfb02a314d3067638a7bc4161bd56049c3 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 211/469] properly mapped the updated Dto to contact table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..cfbc4d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -576,7 +576,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 0973e722fb1897652fa83a65ba27c7e234e94cf6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 212/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index cfbc4d0..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -576,19 +576,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From a31b4b73ab826d396c53c81a4311aaf61ff52e53 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 213/469] Added an API to get contact category by its size --- Marco.Pms.Services/Helpers/MasterHelper.cs | 49 ---------------------- 1 file changed, 49 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index a26f401..11015c8 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -112,55 +112,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } - public async Task> DeleteContactCategory(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contactCategory != null) - { - List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); - if (existingContacts.Count > 0) - { - List? contacts = new List(); - foreach (var contact in existingContacts) - { - contact.ContactCategoryId = null; - contacts.Add(contact); - } - _context.Contacts.UpdateRange(contacts); - } - _context.ContactCategoryMasters.Remove(contactCategory); - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); - } - // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 3b1b6e9d89702ed080a4f5be8852a1b73cde8972 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 214/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..0cad29c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -728,6 +728,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 70c9d4bb3d22aeefd6b45181643e9bf58eb98cf8 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 215/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 0cad29c..980fb68 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -765,6 +765,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 6704e168c3e574f6fbe6b71ec01e1b63ea5e7ced Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 10:57:17 +0530 Subject: [PATCH 216/469] Corrected the typo of ContactTagtId to ContactTagId --- ...Added_Directory_Related_Tables.Designer.cs | 3 --- ...14103249_Added_Directory_Related_Tables.cs | 6 ++--- ...ed_ContactProjectMapping_Table.Designer.cs | 2 -- .../ApplicationDbContextModelSnapshot.cs | 3 --- .../Directory/ContactTagMapping.cs | 2 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 26 +++++++++---------- Marco.Pms.Services/Helpers/MasterHelper.cs | 2 +- 7 files changed, 17 insertions(+), 27 deletions(-) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs index f50346e..aad7361 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -493,9 +493,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - b.HasKey("Id"); b.HasIndex("ContactId"); diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs index 879f54b..7ef6da4 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable @@ -289,8 +288,7 @@ namespace Marco.Pms.DataAccess.Migrations { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + ContactTagId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs index 18a4be6..492cf00 100644 --- a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -516,8 +516,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); b.HasKey("Id"); diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index b80c716..b20483b 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -513,9 +513,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - b.HasKey("Id"); b.HasIndex("ContactId"); diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs index a3d7e9e..91c2835 100644 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -5,7 +5,7 @@ public Guid Id { get; set; } public Guid ContactId { get; set; } public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } + public Guid ContactTagId { get; set; } public ContactTagMaster? ContactTag { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 980fb68..5920cbd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Services.Helpers var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + List TagIds = Tags.Select(t => t.ContactTagId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -89,7 +89,7 @@ namespace Marco.Pms.Services.Helpers foreach (var tagMapping in tagMappingss) { ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); conatctTagVms.Add(tagVM); @@ -147,7 +147,7 @@ namespace Marco.Pms.Services.Helpers List tagMasters = new List(); if (tags.Count > 0) { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagIds = tags.Select(ct => ct.ContactTagId).ToList(); tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); } @@ -188,7 +188,7 @@ namespace Marco.Pms.Services.Helpers { foreach (var contactTag in contactTags) { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagId); if (tagMaster != null) { ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); @@ -307,7 +307,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) @@ -320,7 +320,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = newtag.Id, + ContactTagId = newtag.Id, ContactId = contact.Id }; contactTagMappings.Add(tagMapping); @@ -336,7 +336,7 @@ namespace Marco.Pms.Services.Helpers List phoneVMs = new List(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + var tagIds = contactTagMappings.Select(t => t.ContactTagId).ToList(); tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); @@ -355,7 +355,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTagMappings) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } @@ -404,7 +404,7 @@ namespace Marco.Pms.Services.Helpers var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); @@ -537,7 +537,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -553,7 +553,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = contactTag.Id + ContactTagId = contactTag.Id }); } } @@ -584,7 +584,7 @@ namespace Marco.Pms.Services.Helpers contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); @@ -604,7 +604,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTags) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 11015c8..4d29908 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -161,7 +161,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contactTag != null) { - List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagId == contactTag.Id).ToListAsync(); _context.ContactTagMasters.Remove(contactTag); if (tagMappings.Any()) -- 2.43.0 From 0b308c776bceecb486ea821a1b5a1ba893ced61a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 11:09:30 +0530 Subject: [PATCH 217/469] Addd migrations fro Typo --- ...53019_Fixed_Typo_Of_ColumnName.Designer.cs | 3007 +++++++++++++++++ ...20250519053019_Fixed_Typo_Of_ColumnName.cs | 64 + .../ApplicationDbContextModelSnapshot.cs | 6 +- 3 files changed, 3075 insertions(+), 2 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs diff --git a/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs new file mode 100644 index 0000000..39fe4c3 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs @@ -0,0 +1,3007 @@ +// +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("20250519053019_Fixed_Typo_Of_ColumnName")] + partial class Fixed_Typo_Of_ColumnName + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Grants a user the ability to record their own work hours or presence within the system. This typically involves checking in and checking out, logging break times, and potentially viewing their own attendance history.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage 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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs new file mode 100644 index 0000000..5b33d21 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Fixed_Typo_Of_ColumnName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings"); + + migrationBuilder.AlterColumn( + name: "ContactTagId", + table: "ContactTagMappings", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci", + oldClrType: typeof(Guid), + oldType: "char(36)", + oldNullable: true) + .OldAnnotation("Relational:Collation", "ascii_general_ci"); + + migrationBuilder.AddForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId", + principalTable: "ContactTagMasters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings"); + + migrationBuilder.AlterColumn( + name: "ContactTagId", + table: "ContactTagMappings", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci", + oldClrType: typeof(Guid), + oldType: "char(36)") + .OldAnnotation("Relational:Collation", "ascii_general_ci"); + + migrationBuilder.AddForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId", + principalTable: "ContactTagMasters", + principalColumn: "Id"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index b20483b..d1a3686 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -510,7 +510,7 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactId") .HasColumnType("char(36)"); - b.Property("ContactTagId") + b.Property("ContactTagId") .HasColumnType("char(36)"); b.HasKey("Id"); @@ -2598,7 +2598,9 @@ namespace Marco.Pms.DataAccess.Migrations b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") .WithMany() - .HasForeignKey("ContactTagId"); + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); b.Navigation("Contact"); -- 2.43.0 From 04216791f786808783f9b8f85ee02668511add1a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 13:18:32 +0530 Subject: [PATCH 218/469] Changed tag validation --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5920cbd..ee4751e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -411,7 +411,8 @@ namespace Marco.Pms.Services.Helpers var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); + List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -531,7 +532,10 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tagNames.Contains(tag.Name.ToLower())) + var namecheck = tagNames.Contains(tag.Name.ToLower()); + var idCheck = (!tagIds.Contains(tag.Id ?? Guid.Empty)); + var test = namecheck && idCheck; + if (test) { ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping @@ -559,7 +563,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 92e694243768864ae2410bab6a1226f98421ab39 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 09:46:03 +0530 Subject: [PATCH 219/469] Created an API to get contact profile by its Id --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 18 ++- .../ViewModels/Directory/ContactNoteVM.cs | 8 +- .../ViewModels/Directory/ContactProfileVM.cs | 26 ++++ .../ViewModels/Projects/BasicProjectVM.cs | 8 ++ .../Controllers/DirectoryController.cs | 14 ++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 121 +++++++++++++++++- 6 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -51,6 +51,20 @@ namespace Marco.Pms.Model.Mapper Address = contact.Address ?? string.Empty }; } + public static ContactProfileVM ToContactProfileVMFromContact(this Contact contact) + { + return new ContactProfileVM + { + Id = contact.Id, + Name = contact.Name, + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty, + CreatedAt = contact.CreatedAt, + CreatedBy = contact.CreatedBy != null ? contact.CreatedBy.ToBasicEmployeeVMFromEmployee() : null + }; + } //Contact Phone Mapper public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) @@ -207,7 +221,9 @@ namespace Marco.Pms.Model.Mapper { Id = note.Id, Note = note.Note, - ContactId = note.ContactId + ContactId = note.ContactId, + CreatedAt = note.CreatedAt, + CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null }; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs index 5e1c340..c3ca209 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -1,9 +1,15 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class ContactNoteVM { public Guid Id { get; set; } public string Note { get; set; } = string.Empty; + public DateTime CreatedAt { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } + public DateTime? UpdatedAt { get; set; } + public BasicEmployeeVM? UpdatedBy { get; set; } public Guid ContactId { get; set; } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs new file mode 100644 index 0000000..8103c5c --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs @@ -0,0 +1,26 @@ +using Marco.Pms.Model.ViewModels.Activities; +using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Model.ViewModels.Projects; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactProfileVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public DateTime CreatedAt { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } + public DateTime? UpdatedAt { get; set; } + public BasicEmployeeVM? UpdatedBy { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } + public List? Projects { get; set; } + public List? Buckets { get; set; } + public List? Tags { get; set; } + public List? Notes { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs b/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs new file mode 100644 index 0000000..e08caa9 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Projects +{ + public class BasicProjectVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..12317d3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,20 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("profile/{id}")] + public async Task GetContactProfile(Guid id) + { + var response = await _directoryHelper.GetContactProfile(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ee4751e..c3f0ae0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2,9 +2,11 @@ using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Projects; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Model.ViewModels.Projects; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.EntityFrameworkCore; @@ -213,7 +215,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -627,6 +628,121 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactProfile(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.Include(c => c.ContactCategory).Include(c => c.CreatedBy).FirstOrDefaultAsync(c => c.Id == id && c.IsActive); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + ContactProfileVM contactVM = contact.ToContactProfileVMFromContact(); + DirectoryUpdateLog? updateLog = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => l.RefereanceId == contact.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefaultAsync(); + if (updateLog != null) + { + contactVM.UpdatedAt = updateLog.UpdateAt; + contactVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + + List? phones = await _context.ContactsPhones.Where(p => p.ContactId == contact.Id).ToListAsync(); + if (phones.Any()) + { + List? phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + contactVM.ContactPhones = phoneVMs; + } + + List? emails = await _context.ContactsEmails.Where(e => e.ContactId == contact.Id).ToListAsync(); + if (emails.Any()) + { + List? emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + contactVM.ContactEmails = emailVMs; + } + + List? contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + if (contactProjects.Any()) + { + List projectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + List? projects = await _context.Projects.Where(p => projectIds.Contains(p.Id) && p.TenantId == tenantId).ToListAsync(); + List? projectVMs = new List(); + foreach (var project in projects) + { + BasicProjectVM projectVM = new BasicProjectVM + { + Id = project.Id, + Name = project.Name + }; + projectVMs.Add(projectVM); + } + contactVM.Projects = projectVMs; + } + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + if (contactBuckets.Any() && employeeBuckets.Any()) + { + List contactBucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + List employeeBucketIds = employeeBuckets.Select(eb => eb.BucketId).ToList(); + List? buckets = await _context.Buckets.Where(b => contactBucketIds.Contains(b.Id) && employeeBucketIds.Contains(b.Id)).ToListAsync(); + List? bucketVMs = new List(); + foreach (var bucket in buckets) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + contactVM.Buckets = bucketVMs; + } + List? contactTags = await _context.ContactTagMappings.Where(ct => ct.ContactId == contact.Id).ToListAsync(); + if (contactTags.Any()) + { + List tagIds = contactTags.Select(ct => ct.ContactTagId).ToList(); + List tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + List tagVMs = new List(); + foreach (var tagMaster in tagMasters) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + contactVM.Tags = tagVMs; + } + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + if (notes.Any()) + { + List? noteIds = notes.Select(n => n.Id).ToList(); + List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.Id)).OrderByDescending(l => l.UpdateAt).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + DirectoryUpdateLog? noteUpdateLog = noteUpdateLogs.Where(n => n.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + if (noteUpdateLog != null) + { + noteVM.UpdatedAt = noteUpdateLog.UpdateAt; + noteVM.UpdatedBy = noteUpdateLog.Employee != null ? noteUpdateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + noteVMs.Add(noteVM); + } + contactVM.Notes = noteVMs; + } + _logger.LogInfo("Employee ID {EmployeeId} fetched profile of contact {COntactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact profile fetched successfully"); + + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- @@ -695,7 +811,8 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - + noteVM.UpdatedAt = DateTime.UtcNow; + noteVM.UpdatedBy = LoggedInEmployee.ToBasicEmployeeVMFromEmployee(); _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); -- 2.43.0 From fbfd04c898923bcf17cf48ed5b43a83fa038ffd9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 12:38:09 +0530 Subject: [PATCH 220/469] changed all list in contact profile view model to non-nullable and set default value to empty list --- .../ViewModels/Directory/ContactProfileVM.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs index 8103c5c..9e8f4cb 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs @@ -15,12 +15,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public BasicEmployeeVM? CreatedBy { get; set; } public DateTime? UpdatedAt { get; set; } public BasicEmployeeVM? UpdatedBy { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } + public List ContactPhones { get; set; } = new List(); + public List ContactEmails { get; set; } = new List(); public ContactCategoryVM? ContactCategory { get; set; } - public List? Projects { get; set; } - public List? Buckets { get; set; } - public List? Tags { get; set; } - public List? Notes { get; set; } + public List Projects { get; set; } = new List(); + public List Buckets { get; set; } = new List(); + public List Tags { get; set; } = new List(); + public List Notes { get; set; } = new List(); } } -- 2.43.0 From 635654890eb466079ac0bae599fbca5920458ac2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 10:28:17 +0530 Subject: [PATCH 221/469] Implemented an API to retrieve a list of organizations provided in the contacts. --- Marco.Pms.Services/Controllers/DirectoryController.cs | 7 +++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 12317d3..8f2cb5c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -113,6 +113,13 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("organization")] + public async Task GetOrganizationList() + { + var response = await _directoryHelper.GetOrganizationList(); + return Ok(response); + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c3f0ae0..da8514a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -743,6 +743,15 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); } + public async Task> GetOrganizationList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var organizationList = await _context.Contacts.Where(c => c.TenantId == tenantId).Select(c => c.Organization).Distinct().ToListAsync(); + _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); + return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From 8c9ce52ec26608280655d1e2e55f682d3a0f768f Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Tue, 20 May 2025 10:00:57 +0530 Subject: [PATCH 222/469] created api for contact Tag Update --- .../Controllers/MasterController.cs | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 61baaa3..36a3ee8 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,6 +1,8 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -638,8 +640,7 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - _logger.LogError("User sent empyt payload"); - return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); + } [HttpDelete("work-category/{id}")] @@ -774,7 +775,36 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag/edit/{id}")] public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) { - return Ok(); + + var tenantId = _userHelper.GetTenantId(); + Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContactTagDto != null && updateContactTagDto.Id != id) + { + ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); + if(contactTag != null) + { + contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); + _context.ContactTagMasters.Update(contactTag); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactTag.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + + ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); + + + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); + return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); + } + } + _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); + return NotFound(ApiResponse.ErrorResponse("Contact Tag master not found", "Work category master not found", 404)); + } [HttpDelete("contact-tag/{id}")] -- 2.43.0 From 2e64f4de3223c97ee4ee2ddafec976b2ef8922f7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 17:29:20 +0530 Subject: [PATCH 223/469] Implemented an API to suspend a Contact --- .../Controllers/DirectoryController.cs | 22 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 8f2cb5c..843aacb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -107,6 +107,10 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 404) + { + return NotFound(response); + } else { return BadRequest(response); @@ -120,6 +124,24 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } + [HttpDelete("{id}")] + public async Task DeleteContact(Guid id) + { + var response = await _directoryHelper.DeleteContact(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index da8514a..68562ac 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -752,6 +752,26 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } + public async Task> DeleteContact(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + contact.IsActive = false; + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From aa6df0f803f9a0515bdd96302d918530c6e97199 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 13:05:08 +0000 Subject: [PATCH 224/469] Update Marco.Pms.Services/Helpers/DirectoryHelper.cs Added entrie to DirectoryUpdateLog Table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 68562ac..aacd71a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -765,6 +765,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } contact.IsActive = false; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); -- 2.43.0 From cd091eda56ea394c1378eba16fc3d80ded0ebaf0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 17:26:51 +0530 Subject: [PATCH 225/469] Implemented filtering functionality for Get Contact List API --- .../Dtos/Directory/ContactFilterDto.cs | 9 ++++ .../Controllers/DirectoryController.cs | 4 +- .../Controllers/MasterController.cs | 9 ++-- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 41 +++++++++++++++++-- 4 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs new file mode 100644 index 0000000..3f06388 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactFilterDto + { + public List? BucketIds { get; set; } + public List? CategoryIds { get; set; } + + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 843aacb..2e6db54 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList() + public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(); + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); if (response.StatusCode == 200) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 36a3ee8..dc4cd61 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -640,7 +640,8 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - + _logger.LogError("User sent empyt payload"); + return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); } [HttpDelete("work-category/{id}")] @@ -781,7 +782,7 @@ namespace Marco.Pms.Services.Controllers if (updateContactTagDto != null && updateContactTagDto.Id != id) { ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); - if(contactTag != null) + if (contactTag != null) { contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); _context.ContactTagMasters.Update(contactTag); @@ -796,8 +797,8 @@ namespace Marco.Pms.Services.Controllers ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); - - + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index aacd71a..cebba78 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -29,17 +29,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts() + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - + if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) + { + bucketIds = filterDto.BucketIds; + } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + List contacts = new List(); + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) + { + var categoryIds = filterDto.CategoryIds; + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && categoryIds.Contains(c.ContactCategoryId ?? Guid.Empty) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } + else + { + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); @@ -50,6 +62,19 @@ namespace Marco.Pms.Services.Helpers var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + if (search != null && search != string.Empty) + { + List filteredContactIds = new List(); + phoneNo = phoneNo.Where(p => Compare(p.PhoneNumber, search)).ToList(); + filteredContactIds = phoneNo.Select(p => p.ContactId).ToList(); + + Emails = Emails.Where(e => Compare(e.EmailAddress, search)).ToList(); + filteredContactIds.AddRange(Emails.Select(e => e.ContactId).ToList()); + filteredContactIds = filteredContactIds.Distinct().ToList(); + + contacts = contacts.Where(c => Compare(c.Name, search) || Compare(c.Organization, search) || filteredContactIds.Contains(c.Id)).ToList(); + } + List list = new List(); foreach (var contact in contacts) @@ -66,6 +91,7 @@ namespace Marco.Pms.Services.Helpers var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); + if (emails != null && emails.Count > 0) { foreach (var email in emails) @@ -1005,5 +1031,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + private bool Compare(string sentence, string search) + { + sentence = sentence.Trim().ToLower(); + search = search.Trim().ToLower(); + + // Check for exact substring + bool result = sentence.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; + return result; + } } } -- 2.43.0 From e917ff3e9cc6ff6cedb2c9c510d3d5cb64f8a66e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 22:10:51 +0530 Subject: [PATCH 226/469] Accepting List of buckets and categories Ids rather than as payload --- .../Controllers/DirectoryController.cs | 13 ++++++++---- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 2e6db54..ba05625 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,14 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) + public async Task GetContactList([FromQuery] string? search, [FromQuery] List? bucketIds, [FromQuery] List? categoryIds, [FromQuery] Guid? projectId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); + ContactFilterDto filterDto = new ContactFilterDto + { + BucketIds = bucketIds, + CategoryIds = categoryIds + }; + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto, projectId); if (response.StatusCode == 200) @@ -164,9 +169,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet("note/{ContactId}")] - public async Task GetNoteListByContactId(Guid contactId) + public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetNoteListByContactId(contactId); + var response = await _directoryHelper.GetNoteListByContactId(contactId, active); if (response.StatusCode == 200) { return Ok(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index cebba78..36c6884 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -29,20 +29,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto, Guid? projectId) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { - bucketIds = filterDto.BucketIds; + filterbucketIds = filterDto.BucketIds; } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + List contactIds = contactBuckets.Where(b => filterbucketIds.Contains(b.BucketId)).Select(cb => cb.ContactId).ToList(); List contacts = new List(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + if (projectId != null && projectId != Guid.Empty) + { + contactProjects = contactProjects.Where(p => p.ProjectId == projectId).ToList(); + contactIds = contactProjects.Select(p => p.ContactId).Distinct().ToList(); + } + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) { var categoryIds = filterDto.CategoryIds; @@ -56,7 +65,6 @@ namespace Marco.Pms.Services.Helpers var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); List TagIds = Tags.Select(t => t.ContactTagId).ToList(); @@ -809,14 +817,14 @@ namespace Marco.Pms.Services.Helpers // -------------------------------- Contact Notes -------------------------------- - public async Task> GetNoteListByContactId(Guid id) + public async Task> GetNoteListByContactId(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { -- 2.43.0 From c00d1a5451500d9d6e66f12d2c2c20ff1cf8cb09 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 19:48:45 +0530 Subject: [PATCH 227/469] Implemented an API to update Buckets for grouping contacts. --- .../Dtos/Directory/UpdateBucketDto.cs | 9 ++++++ .../Controllers/DirectoryController.cs | 18 +++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 31 ++++++++++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs new file mode 100644 index 0000000..4428941 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateBucketDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index ba05625..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -247,5 +247,23 @@ namespace Marco.Pms.Services.Controllers } } + + [HttpPut("bucket/{id}")] + public async Task UpdateBucket(Guid id, [FromBody] UpdateBucketDto bucketDto) + { + var response = await _directoryHelper.UpdateBucket(id, bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 36c6884..8cf2b1e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1001,7 +1001,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } - public async Task> CreateBucket(CreateBucketDto bucketDto) { Guid tenantId = _userHelper.GetTenantId(); @@ -1038,7 +1037,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateBucket(Guid id, UpdateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null && id == bucketDto.Id) + { + var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + bucket.Name = bucketDto.Name ?? ""; + bucket.Description = bucketDto.Description ?? ""; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketDto.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 02a7791041e7ab80099ce151872805e8eb1831f0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 20:27:13 +0530 Subject: [PATCH 228/469] Implemented an API to update Contact Category Master --- .../Controllers/MasterController.cs | 55 +++++++--------- Marco.Pms.Services/Helpers/MasterHelper.cs | 65 +++++++++++++++++++ 2 files changed, 89 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index dc4cd61..3512081 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,8 +1,6 @@ using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -717,11 +715,22 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } - [HttpPost("contact-category/edit/{id}")] public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) { - return Ok(); + var response = await _masterHelper.UpdateContactCategory(id, updateContactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("contact-category/{id}")] @@ -776,36 +785,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag/edit/{id}")] public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) { - - var tenantId = _userHelper.GetTenantId(); - Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContactTagDto != null && updateContactTagDto.Id != id) + var response = await _masterHelper.UpdateContactTag(id, updateContactTagDto); + if (response.StatusCode == 200) { - ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); - if (contactTag != null) - { - contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); - _context.ContactTagMasters.Update(contactTag); - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contactTag.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - - ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); - - - - _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); - return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); - } + return Ok(response); } - _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); - return NotFound(ApiResponse.ErrorResponse("Contact Tag master not found", "Work category master not found", 404)); + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("contact-tag/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 4d29908..55883f6 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,6 +1,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Master; @@ -47,6 +48,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContactCategory(Guid id, UpdateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null && id == contactCategoryDto.Id) + { + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Id == id); + if (contactCategory != null) + { + contactCategory.Name = contactCategoryDto.Name ?? ""; + contactCategory.Description = contactCategoryDto.Description ?? ""; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactCategory.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a contact category but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -154,6 +186,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContactTag(Guid id, UpdateContactTagDto contactTagDto) + { + var tenantId = _userHelper.GetTenantId(); + Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null && contactTagDto.Id != id) + { + ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == contactTagDto.Id); + if (contactTag != null) + { + contactTag = contactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); + _context.ContactTagMasters.Update(contactTag); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactTag.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + + ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); + + + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully by employee {EmployeeId}", contactTagVm.Id, LoggedInEmployee.Id); + ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200); + } + _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); + ApiResponse.ErrorResponse("Contact Tag master not found", "Contact tag master not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> DeleteContactTag(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 2339384b5e0aec11144f589f2243f8482cb5c276 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 24 May 2025 15:45:43 +0530 Subject: [PATCH 229/469] Add Directory Management Feature with Permission Handling --- .../Data/ApplicationDbContext.cs | 17 +- ...d_Feature_Directory_Management.Designer.cs | 3055 +++++++++++++++++ ...4333_Added_Feature_Directory_Management.cs | 100 + .../ApplicationDbContextModelSnapshot.cs | 48 + Marco.Pms.Model/Directory/Bucket.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 + 6 files changed, 3219 insertions(+), 9 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 5acbbe2..20250a2 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -477,17 +477,15 @@ namespace Marco.Pms.DataAccess.Data modelBuilder.Entity().HasData( new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Manage Project", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, new Feature { Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), Description = "Manage Infra", Name = "Manage Infra", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, - new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Task Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), 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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, - - new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Employee Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true }, new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true }, - new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } - //new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } + new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }, + new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Managing all directory related rights", Name = "Directory Management", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } + + //new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } ); modelBuilder.Entity().HasData( @@ -514,8 +512,11 @@ namespace Marco.Pms.DataAccess.Data new FeaturePermission { Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Regularize Attendance", Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records" }, new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency" }, - new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" } - //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("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" }, + + new FeaturePermission { Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Admin", Description = "Full control over all directories, including the ability to manage permissions for all directories in the system." }, + new FeaturePermission { Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Manager", Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories." }, + new FeaturePermission { Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory User", Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created." } //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/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs new file mode 100644 index 0000000..6e2f931 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs @@ -0,0 +1,3055 @@ +// +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("20250524074333_Added_Feature_Directory_Management")] + partial class Added_Feature_Directory_Management + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedByID"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Grants a user the ability to record their own work hours or presence within the system. This typically involves checking in and checking out, logging break times, and potentially viewing their own attendance history.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" + }); + }); + + 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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs new file mode 100644 index 0000000..1319786 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs @@ -0,0 +1,100 @@ +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 Added_Feature_Directory_Management : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CreatedAt", + table: "Buckets", + type: "datetime(6)", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "CreatedByID", + table: "Buckets", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.InsertData( + table: "Features", + columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" }, + values: new object[] { new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Managing all directory related rights", true, new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), "Directory Management" }); + + migrationBuilder.InsertData( + table: "FeaturePermissions", + columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" }, + values: new object[,] + { + { new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory User" }, + { new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), "Full control over all directories, including the ability to manage permissions for all directories in the system.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Admin" }, + { new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Manager" } + }); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_CreatedByID", + table: "Buckets", + column: "CreatedByID"); + + migrationBuilder.AddForeignKey( + name: "FK_Buckets_Employees_CreatedByID", + table: "Buckets", + column: "CreatedByID", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Buckets_Employees_CreatedByID", + table: "Buckets"); + + migrationBuilder.DropIndex( + name: "IX_Buckets_CreatedByID", + table: "Buckets"); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("0f919170-92d4-4337-abd3-49b66fc871bb")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("62668630-13ce-4f52-a0f0-db38af2230c5")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606")); + + migrationBuilder.DropColumn( + name: "CreatedAt", + table: "Buckets"); + + migrationBuilder.DropColumn( + name: "CreatedByID", + table: "Buckets"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index d1a3686..885445c 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -269,6 +269,12 @@ namespace Marco.Pms.DataAccess.Migrations .ValueGeneratedOnAdd() .HasColumnType("char(36)"); + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + b.Property("Description") .IsRequired() .HasColumnType("longtext"); @@ -282,6 +288,8 @@ namespace Marco.Pms.DataAccess.Migrations b.HasKey("Id"); + b.HasIndex("CreatedByID"); + b.HasIndex("TenantId"); b.ToTable("Buckets"); @@ -961,6 +969,30 @@ namespace Marco.Pms.DataAccess.Migrations FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" }); }); @@ -1396,6 +1428,14 @@ namespace Marco.Pms.DataAccess.Migrations IsActive = true, ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" }); }); @@ -2448,12 +2488,20 @@ namespace Marco.Pms.DataAccess.Migrations modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("CreatedBy"); + b.Navigation("Tenant"); }); diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs index 028b428..0d382c5 100644 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -1,4 +1,5 @@ -using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; namespace Marco.Pms.Model.Directory { @@ -6,6 +7,9 @@ namespace Marco.Pms.Model.Directory { public Guid Id { get; set; } public string Name { get; set; } = string.Empty; + public Guid CreatedByID { get; set; } + public Employee? CreatedBy { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8cf2b1e..c11f9a8 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1017,6 +1017,8 @@ namespace Marco.Pms.Services.Helpers { Name = bucketDto.Name, Description = bucketDto.Description, + CreatedAt = DateTime.UtcNow, + CreatedByID = LoggedInEmployee.Id, TenantId = tenantId }; _context.Buckets.Add(bucket); -- 2.43.0 From 2119171291797365a540415dd75dbbafafa0546f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 230/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 654890a..012c7f8 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -6,4 +6,3 @@ public string? EmailAddress { get; set; } } } - -- 2.43.0 From 39224c7ed732850b62777d0f8490c221b8432ad2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 16:10:07 +0530 Subject: [PATCH 231/469] Added Migration for contact related tables --- .../20250514103249_Added_Directory_Related_Tables.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs index 7ef6da4..3dc4b68 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -- 2.43.0 From 20efab871ab63c3aa1d613aac66652b7d4cf857b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 232/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 1 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 58 ------------------- .../appsettings.Development.json | 2 + 3 files changed, 3 insertions(+), 58 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 012c7f8..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -6,3 +6,4 @@ public string? EmailAddress { get; set; } } } + diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c11f9a8..a7e473a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -920,65 +920,7 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } // -------------------------------- Bucket -------------------------------- diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json index 8bec8d7..3b4aed8 100644 --- a/Marco.Pms.Services/appsettings.Development.json +++ b/Marco.Pms.Services/appsettings.Development.json @@ -7,6 +7,8 @@ "ConnectionStrings": { "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS10" + //"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2" + "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSDev" }, "SmtpSettings": { "SmtpServer": "smtp.gmail.com", -- 2.43.0 From 62734fc583abfcb342733c0a5b2bf5c3274ae3a8 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 233/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 55883f6..df9cee1 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,6 +144,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 040e9c311b2e1065c2e9b822061e14d92a1d7b5f Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 234/469] added api to get list of contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index df9cee1..8cabe24 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,21 +144,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 4cebaba5406319ca1c9fa096fdc19eac60b6a11c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 235/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 + 6 files changed, 3145 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 20250a2..7e29061 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..d9f9a66 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,6 +63,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a7e473a..f21a5d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -62,6 +62,7 @@ namespace Marco.Pms.Services.Helpers contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); } + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); @@ -442,6 +443,9 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); -- 2.43.0 From 244a6cc5471e14fa6cd5c95a61e596274c5a203f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 236/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 57 +- 12 files changed, 17 insertions(+), 3268 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 7e29061..20250a2 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 885445c..f44a57e 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -328,6 +328,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -483,32 +486,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2609,33 +2586,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..358bf54 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d9f9a66..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,24 +63,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f21a5d0..298064d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -97,8 +97,6 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); if (emails != null && emails.Count > 0) @@ -111,7 +109,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -121,7 +119,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -134,17 +132,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -270,8 +260,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -294,7 +282,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -310,29 +297,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -350,8 +316,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -362,9 +327,7 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); @@ -401,8 +364,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -588,8 +549,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -657,9 +617,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From b7a9d6148d03c429ee7d0f6e6239a4dc3181a974 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 237/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 ++++++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 60 ++++++++++++++++--- 8 files changed, 131 insertions(+), 17 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index f44a57e..885445c 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -328,9 +328,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -486,6 +483,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2586,6 +2609,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 358bf54..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 298064d..4a7ad9e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -97,6 +97,8 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); if (emails != null && emails.Count > 0) @@ -109,7 +111,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -119,7 +121,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -132,9 +134,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -260,6 +270,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -282,6 +294,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -297,8 +310,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -316,7 +350,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -327,7 +362,9 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); @@ -364,6 +401,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -410,6 +449,9 @@ namespace Marco.Pms.Services.Helpers List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); @@ -549,7 +591,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -617,6 +660,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 7ae001e2772c36ef1a6a567d66f65b3a327f9df7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 238/469] properly mapped the updated Dto to contact table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4a7ad9e..5f06203 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -622,7 +622,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 45897b99cb0b7fa539a4a0fdc53ceb9551ba4e4c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 239/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5f06203..4a7ad9e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -622,19 +622,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 852124d971bd33e3b238979827abc6394e1eb96a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:13:35 +0530 Subject: [PATCH 240/469] added an API to get a list of contact-notes by contact ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4a7ad9e..bca931c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -443,12 +443,6 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); -- 2.43.0 From 29fa0e87d1d432627bcb549f9e452138f2130ca6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 241/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index bca931c..80fd413 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -923,6 +923,44 @@ namespace Marco.Pms.Services.Helpers + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From cc06c2dfc4f600dab9e768a669b1eb331f9c971d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 242/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 80fd413..d7cc3b1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -960,6 +960,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From e4a611ccc25ea9c20ae076996155a8971a415ceb Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 243/469] created GetListOfContact custome function --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d7cc3b1..c4c1bd3 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -923,65 +923,6 @@ namespace Marco.Pms.Services.Helpers - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From b161ed7c152eab52f35d3d74d612901e41426cd2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 244/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 8cabe24..9161d35 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -145,6 +145,22 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From fd146709143749c65879c0094eed669d1f473017 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 245/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Services/Helpers/MasterHelper.cs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 9161d35..55883f6 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,23 +144,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } - // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From f6685a1ca52072917cc0f5b20bbbdfa0484bfec2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 246/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 + 6 files changed, 3145 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 20250a2..7e29061 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..d9f9a66 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,6 +63,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c4c1bd3..179276b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -63,6 +63,7 @@ namespace Marco.Pms.Services.Helpers } + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); @@ -443,6 +444,9 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); -- 2.43.0 From b0aefdc93a801c39aac319355a37a80575885cb5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 247/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 6 +- 12 files changed, 13 insertions(+), 3221 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 7e29061..20250a2 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 885445c..f44a57e 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -328,6 +328,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -483,32 +486,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2609,33 +2586,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..358bf54 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d9f9a66..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,24 +63,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 179276b..ecedf48 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -112,7 +112,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -122,7 +122,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -311,7 +311,7 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } if (createContact.ProjectIds != null) -- 2.43.0 From 86ebc95adad8215c11aacde860b51a31bee3fb4c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 248/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 ++++++++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 ++- 8 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index f44a57e..885445c 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -328,9 +328,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -486,6 +483,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2586,6 +2609,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 358bf54..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ecedf48..ada9b06 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -112,7 +112,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -122,7 +122,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -311,7 +311,7 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } if (createContact.ProjectIds != null) @@ -450,6 +450,9 @@ namespace Marco.Pms.Services.Helpers List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); -- 2.43.0 From e9157d79859ec19f288babd5894c9e34097f27d5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 249/469] properly mapped the updated Dto to contact table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ada9b06..127aad5 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -623,7 +623,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 75cb4557e45241b08edc02191e8d9faadb42be2f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 250/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 127aad5..b787cd6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -156,6 +156,7 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } + public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -410,6 +411,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -444,12 +446,6 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); -- 2.43.0 From dff77aa22f713ca727a104bd835d4e0fb6a76e31 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 251/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b787cd6..f2f5b47 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -939,6 +939,44 @@ namespace Marco.Pms.Services.Helpers + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 93e1b13f54754f59ca4bcdd52746a345019ac6d2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 252/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f2f5b47..57300b6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -976,6 +976,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 88204835840264d6ec6d4c253b6ef5744a0aba7a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 09:46:03 +0530 Subject: [PATCH 253/469] Created an API to get contact profile by its Id --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 57300b6..86d9449 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -939,65 +939,6 @@ namespace Marco.Pms.Services.Helpers - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 6b80c3bfeb1f96091ddfea2fc79776331846f555 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 24 May 2025 15:45:43 +0530 Subject: [PATCH 254/469] Add Directory Management Feature with Permission Handling --- Marco.Pms.Services/appsettings.Development.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json index 3b4aed8..06c724b 100644 --- a/Marco.Pms.Services/appsettings.Development.json +++ b/Marco.Pms.Services/appsettings.Development.json @@ -6,9 +6,7 @@ }, "ConnectionStrings": { - "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS10" - //"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2" - "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSDev" + "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSGuid" }, "SmtpSettings": { "SmtpServer": "smtp.gmail.com", -- 2.43.0 From 5908b543127fd78200de08c4616d517ff496cc6d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:24:41 +0530 Subject: [PATCH 255/469] Enhancement #375: Update "Get Contact" API to Enforce Feature Permissions --- .../Controllers/DirectoryController.cs | 5 ++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 29 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..de262fb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -39,12 +39,17 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); } } + [HttpGet("contact-bucket/{bucketId}")] public async Task GetContactsListByBucketId(Guid bucketId) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 86d9449..1beb114 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -18,13 +18,18 @@ namespace Marco.Pms.Services.Helpers private readonly ApplicationDbContext _context; private readonly ILoggingService _logger; private readonly UserHelper _userHelper; - + private readonly Guid directoryAdmin; + private readonly Guid directoryManager; + private readonly Guid directoryUser; public DirectoryHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) { _context = context; _logger = logger; _userHelper = userHelper; + directoryAdmin = Guid.Parse("4286a13b-bb40-4879-8c6d-18e9e393beda"); + directoryManager = Guid.Parse("62668630-13ce-4f52-a0f0-db38af2230c5"); + directoryUser = Guid.Parse("0f919170-92d4-4337-abd3-49b66fc871bb"); } @@ -33,9 +38,29 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + if (permissionIds.Contains(directoryAdmin)) + { + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketIds = buckets.Select(b => b.Id).ToList(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + var createdBucketIds = buckets.Select(b => b.Id).ToList(); + bucketIds.AddRange(createdBucketIds); + bucketIds = bucketIds.Distinct().ToList(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a contacts, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + + List filterbucketIds = bucketIds; if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { filterbucketIds = filterDto.BucketIds; -- 2.43.0 From 10df95c481d3e32704721d0b3774835055321505 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:27:04 +0530 Subject: [PATCH 256/469] Enhancement #376: Update "Get Contact by Bucket ID" API to Enforce Feature Permissions --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 1beb114..f3421b1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -188,12 +188,37 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (id != Guid.Empty) { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} attempted access to bucket ID {BucketId}, but not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(em => em.BucketId == id).ToListAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + + EmployeeBucketMapping? employeeBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + employeeBucket = employeeBuckets.FirstOrDefault(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + employeeBucket = employeeBuckets.FirstOrDefault(eb => eb.EmployeeId == LoggedInEmployee.Id); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a contacts with in bucket {BucketId}, but do not have permission", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + if (employeeBucket == null) { _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); List contactVMs = new List(); if (contactBucket.Count > 0) -- 2.43.0 From a0cc285d6fd4a69a6973439b98a8a5c0c1736d07 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:28:22 +0530 Subject: [PATCH 257/469] Enhancement #377: Update "Update Contact" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 4 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index de262fb..6b54891 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -103,6 +103,10 @@ namespace Marco.Pms.Services.Controllers { return NotFound(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f3421b1..8dd25fd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -480,6 +480,33 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + if (permissionIds.Contains(directoryAdmin)) + { + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketIds = buckets.Select(b => b.Id).ToList(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + var createdBucketIds = buckets.Select(b => b.Id).ToList(); + bucketIds.AddRange(createdBucketIds); + bucketIds = bucketIds.Distinct().ToList(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to update a contact, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id && bucketIds.Contains(m.BucketId)).ToListAsync(); + bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); await _context.SaveChangesAsync(); @@ -489,8 +516,7 @@ namespace Marco.Pms.Services.Helpers List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var emailIds = emails.Select(p => p.Id).ToList(); - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); -- 2.43.0 From b5707ba1332f78e1b02115eddad89844a55b04c4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:32:51 +0530 Subject: [PATCH 258/469] Enhancement #378: Update "Get Bucket List" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 13 ++++++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 28 +++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 6b54891..d25c7e8 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -226,7 +226,18 @@ namespace Marco.Pms.Services.Controllers public async Task GetBucketList() { var response = await _directoryHelper.GetBucketList(); - return Ok(response); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } } [HttpPost("bucket")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8dd25fd..d319a1b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1022,20 +1022,38 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + List bucketList = new List(); + if (permissionIds.Contains(directoryAdmin)) + { + bucketList = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a buckets list, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } List bucketVMs = new List(); - foreach (var bucket in bucketList) + if (bucketList.Any()) { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } } _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); } public async Task> CreateBucket(CreateBucketDto bucketDto) { -- 2.43.0 From c2ddd6097cc45a09ef7c5cc63547b5fb61884e3e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:35:09 +0530 Subject: [PATCH 259/469] Enhancement #380: Update "Create Bucket" API to Enforce Feature --- Marco.Pms.Services/Controllers/DirectoryController.cs | 4 ++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d25c7e8..680a708 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -261,6 +261,10 @@ namespace Marco.Pms.Services.Controllers { return Conflict(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d319a1b..66af082 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1061,6 +1061,15 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (bucketDto != null) { + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var demo = !permissionIds.Contains(directoryUser); + if (!permissionIds.Contains(directoryAdmin) && !permissionIds.Contains(directoryManager) && !permissionIds.Contains(directoryUser)) + { + _logger.LogError("Employee {EmployeeId} attemped to create a bucket, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); if (existingBucket != null) { -- 2.43.0 From bd969616ad9bd306181d2d0c80a9b6f53f3035ee Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:37:24 +0530 Subject: [PATCH 260/469] Enhancement #381: Update "Update Bucket" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 4 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 29 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 680a708..cfc9ed8 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -284,6 +284,10 @@ namespace Marco.Pms.Services.Controllers { return NotFound(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 66af082..57fed5d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1108,12 +1108,39 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (bucketDto != null && id == bucketDto.Id) { - var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var bucketIds = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToListAsync(); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) { _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); } + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + bucket.Name = bucketDto.Name ?? ""; bucket.Description = bucketDto.Description ?? ""; -- 2.43.0 From 193add07e1567bf4504b40ffacf010585293959e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 16:29:42 +0530 Subject: [PATCH 261/469] Implement API to Assign Bucket to Employees --- .../Dtos/Directory/AssignBucketDto.cs | 8 ++ Marco.Pms.Model/Mapper/DirectoryMapper.cs | 9 ++ .../ViewModels/Directory/AssignBucketVM.cs | 10 ++ .../Controllers/DirectoryController.cs | 24 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 116 +++++++++++++++++- 5 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs diff --git a/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs new file mode 100644 index 0000000..f675cf3 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class AssignBucketDto + { + public Guid EmployeeId { get; set; } + public bool IsActive { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..2aea3c0 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -202,6 +202,15 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) + { + return new AssignBucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } //Contact Note public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs new file mode 100644 index 0000000..f4c8e2b --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class AssignBucketVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public List? EmployeeIds { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index cfc9ed8..192143d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -177,7 +177,7 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("note/{ContactId}")] + [HttpGet("notes/{ContactId}")] public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { var response = await _directoryHelper.GetNoteListByContactId(contactId, active); @@ -293,5 +293,27 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } + + [HttpPost("assign-bucket/{bucketId}")] + public async Task AssignBucket(Guid bucketId, [FromBody] List assignBuckets) + { + var response = await _directoryHelper.AssignBucket(bucketId, assignBuckets); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 57fed5d..35a11d7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1043,15 +1043,21 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); } - List bucketVMs = new List(); + List bucketVMs = new List(); if (bucketList.Any()) { foreach (var bucket in bucketList) { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + bucketVM.EmployeeIds = emplyeeIds; + bucketVMs.Add(bucketVM); } } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); } @@ -1110,7 +1116,8 @@ namespace Marco.Pms.Services.Helpers { var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - var bucketIds = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToListAsync(); + var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); if (bucket == null) @@ -1153,13 +1160,114 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + bucketVM.EmployeeIds = employeeIds; + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); } _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> AssignBucket(Guid bucketId, List assignBuckets) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (assignBuckets != null && bucketId != Guid.Empty) + { + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); + + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(bucketId)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + var employeeIds = await _context.Employees.Where(e => e.TenantId == tenantId && e.IsActive).Select(e => e.Id).ToListAsync(); + int assignedEmployee = 0; + int removededEmployee = 0; + foreach (var assignBucket in assignBuckets) + { + if (employeeIds.Contains(assignBucket.EmployeeId)) + { + if (assignBucket.IsActive) + { + EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping + { + EmployeeId = assignBucket.EmployeeId, + BucketId = bucketId + }; + _context.EmployeeBucketMappings.Add(employeeBucketMapping); + assignedEmployee += 1; + } + else + { + EmployeeBucketMapping? employeeBucketMapping = employeeBuckets.FirstOrDefault(eb => eb.BucketId == bucketId && eb.EmployeeId == assignBucket.EmployeeId); + if (employeeBucketMapping != null) + { + _context.EmployeeBucketMappings.Remove(employeeBucketMapping); + removededEmployee += 1; + } + } + } + } + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketId, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); + employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + bucketVM.EmployeeIds = employeeIds; + + + if (assignedEmployee > 0) + { + _logger.LogInfo("Employee {EmployeeId} assigned bucket {BucketId} to {conut} number of employees", LoggedInEmployee.Id, bucketId, assignedEmployee); + } + if (removededEmployee > 0) + { + _logger.LogError("Employee {EmployeeId} removed {conut} number of employees from bucket {BucketId}", LoggedInEmployee.Id, removededEmployee, bucketId); + } + return ApiResponse.SuccessResponse(bucketVM, "Details updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 56645ff40ff0acd16eed517ac43ef5a3e4d3cbe6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 10:40:00 +0530 Subject: [PATCH 262/469] Implemented an API to delete a Bucket --- .../Controllers/AttendanceController.cs | 4 +- .../Controllers/DirectoryController.cs | 30 ++++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 78 +++++++++++++++++-- 3 files changed, 101 insertions(+), 11 deletions(-) diff --git a/Marco.Pms.Services/Controllers/AttendanceController.cs b/Marco.Pms.Services/Controllers/AttendanceController.cs index 73fe2f5..e6b5804 100644 --- a/Marco.Pms.Services/Controllers/AttendanceController.cs +++ b/Marco.Pms.Services/Controllers/AttendanceController.cs @@ -137,12 +137,12 @@ namespace MarcoBMS.Services.Controllers if (dateFrom != null && DateTime.TryParse(dateFrom, out fromDate) == false) { - _logger.LogError("User sent Invalid from Date while featching attendance logs"); + _logger.LogError("User sent Invalid fromDate while featching attendance logs"); return BadRequest(ApiResponse.ErrorResponse("Invalid Date", "Invalid Date", 400)); } if (dateTo != null && DateTime.TryParse(dateTo, out toDate) == false) { - _logger.LogError("User sent Invalid to Date while featching attendance logs"); + _logger.LogError("User sent Invalid toDate while featching attendance logs"); return BadRequest(ApiResponse.ErrorResponse("Invalid Date", "Invalid Date", 400)); } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 192143d..2bf22ea 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -139,9 +139,9 @@ namespace Marco.Pms.Services.Controllers } [HttpDelete("{id}")] - public async Task DeleteContact(Guid id) + public async Task DeleteContact(Guid id, [FromQuery] bool? active) { - var response = await _directoryHelper.DeleteContact(id); + var response = await _directoryHelper.DeleteContact(id, active ?? false); if (response.StatusCode == 200) { return Ok(response); @@ -214,9 +214,9 @@ namespace Marco.Pms.Services.Controllers } [HttpDelete("note/{id}")] - public async Task DeleteContactNote(Guid id) + public async Task DeleteContactNote(Guid id, [FromQuery] bool? active) { - var response = await _directoryHelper.DeleteContactNote(id); + var response = await _directoryHelper.DeleteContactNote(id, active ?? false); return Ok(response); } @@ -315,5 +315,27 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } + + [HttpDelete("bucket/{id}")] + public async Task DeleteBucket(Guid id) + { + var response = await _directoryHelper.DeleteBucket(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 35a11d7..4990d11 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -878,7 +878,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } - public async Task> DeleteContact(Guid id) + public async Task> DeleteContact(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -890,7 +890,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - contact.IsActive = false; + contact.IsActive = active; _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog { @@ -916,7 +916,15 @@ namespace Marco.Pms.Services.Helpers Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); + List notes = new List(); + if (active) + { + notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive && n.TenantId == tenantId).ToListAsync(); + } + else + { + notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); + } List? noteVMs = new List(); foreach (var note in notes) { @@ -989,7 +997,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> DeleteContactNote(Guid id) + public async Task> DeleteContactNote(Guid id, bool active) { Guid tenentId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -997,7 +1005,7 @@ namespace Marco.Pms.Services.Helpers ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); if (note != null) { - note.IsActive = false; + note.IsActive = active; _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog { RefereanceId = id, @@ -1268,6 +1276,66 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteBucket(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + + if (bucket != null) + { + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + + if (contactBuckets.Any()) + { + _logger.LogInfo("Employee {EmployeeId} attempted to deleted bucket {BucketId},but bucket have contacts in it.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("This bucket can not be deleted", "This bucket can not be deleted", 400); + } + + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + + _context.EmployeeBucketMappings.RemoveRange(employeeBuckets); + _context.Buckets.Remove(bucket); + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 738d1e6a0a5e54653733850b14b96431bbaa1808 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 10:45:03 +0530 Subject: [PATCH 263/469] Corrected Spelling mistakes --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4990d11..8011fc4 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -999,10 +999,10 @@ namespace Marco.Pms.Services.Helpers } public async Task> DeleteContactNote(Guid id, bool active) { - Guid tenentId = _userHelper.GetTenantId(); + Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); if (note != null) { note.IsActive = active; @@ -1278,10 +1278,10 @@ namespace Marco.Pms.Services.Helpers } public async Task> DeleteBucket(Guid id) { - Guid tenentId = _userHelper.GetTenantId(); + Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); if (bucket != null) { @@ -1330,7 +1330,7 @@ namespace Marco.Pms.Services.Helpers }); await _context.SaveChangesAsync(); _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); } _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); -- 2.43.0 From 8ef654ad2e400947489dbc7ac2cf30c320d02c97 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 11:36:40 +0530 Subject: [PATCH 264/469] Sending number of conacts within the bucket with it information in API Update bucket, Assign Bucket, and Get Bucket List --- .../ViewModels/Directory/AssignBucketVM.cs | 1 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs index f4c8e2b..e5c16ab 100644 --- a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -6,5 +6,6 @@ public string? Name { get; set; } public string? Description { get; set; } public List? EmployeeIds { get; set; } + public int NumberOfContacts { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8011fc4..d769a9f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1054,14 +1054,16 @@ namespace Marco.Pms.Services.Helpers List bucketVMs = new List(); if (bucketList.Any()) { + bucketIds = bucketList.Select(b => b.Id).ToList(); + List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); foreach (var bucket in bucketList) { List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); - + List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); bucketVM.EmployeeIds = emplyeeIds; - + bucketVM.NumberOfContacts = contactBuckets.Count; bucketVMs.Add(bucketVM); } } @@ -1170,8 +1172,10 @@ namespace Marco.Pms.Services.Helpers AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); bucketVM.EmployeeIds = employeeIds; + bucketVM.NumberOfContacts = contactBuckets.Count; _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); @@ -1259,9 +1263,10 @@ namespace Marco.Pms.Services.Helpers AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); + List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); bucketVM.EmployeeIds = employeeIds; - + bucketVM.NumberOfContacts = contactBuckets.Count; if (assignedEmployee > 0) { -- 2.43.0 From da797b2208e59c4bc3ef4a76561e70862213c098 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 12:48:02 +0530 Subject: [PATCH 265/469] Included object consist of basic infromation of employee who created the bucket in View models --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 6 ++++-- Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs | 5 ++++- Marco.Pms.Model/ViewModels/Directory/BucketVM.cs | 5 ++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++----- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2aea3c0..4732542 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -199,7 +199,8 @@ namespace Marco.Pms.Model.Mapper { Id = bucket.Id, Name = bucket.Name, - Description = bucket.Description + Description = bucket.Description, + CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null }; } public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) @@ -208,7 +209,8 @@ namespace Marco.Pms.Model.Mapper { Id = bucket.Id, Name = bucket.Name, - Description = bucket.Description + Description = bucket.Description, + CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null }; } diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs index e5c16ab..1458cfb 100644 --- a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -1,10 +1,13 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class AssignBucketVM { public Guid Id { get; set; } public string? Name { get; set; } public string? Description { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } public List? EmployeeIds { get; set; } public int NumberOfContacts { get; set; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs index ce9ed9e..a266658 100644 --- a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs @@ -1,9 +1,12 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class BucketVM { public Guid Id { get; set; } public string? Name { get; set; } public string? Description { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d769a9f..d91fc1f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1039,11 +1039,11 @@ namespace Marco.Pms.Services.Helpers List bucketList = new List(); if (permissionIds.Contains(directoryAdmin)) { - bucketList = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => b.TenantId == tenantId).ToListAsync(); } else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) { - bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); } else { @@ -1110,7 +1110,7 @@ namespace Marco.Pms.Services.Helpers _context.EmployeeBucketMappings.Add(employeeBucket); await _context.SaveChangesAsync(); - + bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucket.Id) ?? new Bucket(); BucketVM bucketVM = bucket.ToBucketVMFromBucket(); _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); @@ -1128,7 +1128,7 @@ namespace Marco.Pms.Services.Helpers var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); if (bucket == null) { @@ -1192,7 +1192,7 @@ namespace Marco.Pms.Services.Helpers var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); + Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); if (bucket == null) { -- 2.43.0 From 85b327d0c49567bfd1bb876a6bc7bf8ed7aafd17 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:00:56 +0530 Subject: [PATCH 266/469] Sending last updatedBy and updatedAt when sending list of notes --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d91fc1f..c208db2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -925,11 +925,25 @@ namespace Marco.Pms.Services.Helpers { notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); } + var noteIds = notes.Select(n => n.Id).ToList(); + List? updateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.RefereanceId)).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + DirectoryUpdateLog? updateLog = updateLogs.Where(l => l.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + if (updateLog != null) + { + noteVM.UpdatedAt = updateLog.UpdateAt; + noteVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + else + { + noteVM.UpdatedAt = note.CreatedAt; + noteVM.UpdatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null; + } noteVMs.Add(noteVM); + } _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); -- 2.43.0 From ff2b33a66d63988061a368ee3a5d56620493d316 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:14:31 +0530 Subject: [PATCH 267/469] Stopping multiple entries in employee-bucket mapping table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c208db2..df55a35 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1215,7 +1215,7 @@ namespace Marco.Pms.Services.Helpers } var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - + var employeeBucketIds = employeeBuckets.Select(eb => eb.EmployeeId).ToList(); Bucket? accessableBucket = null; if (permissionIds.Contains(directoryAdmin)) { @@ -1244,7 +1244,7 @@ namespace Marco.Pms.Services.Helpers { if (employeeIds.Contains(assignBucket.EmployeeId)) { - if (assignBucket.IsActive) + if (assignBucket.IsActive && !employeeBucketIds.Contains(assignBucket.EmployeeId)) { EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping { -- 2.43.0 From 03b62cd27b0067996dc68fbf4279bf3aab13f836 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:55:00 +0530 Subject: [PATCH 268/469] fixed the bug of only sending ID of logged in employee in Bucket object --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index df55a35..69b0b5d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1049,7 +1049,7 @@ namespace Marco.Pms.Services.Helpers List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - + List employeeBucketVM = await _context.EmployeeBucketMappings.Where(b => bucketIds.Contains(b.BucketId)).ToListAsync(); List bucketList = new List(); if (permissionIds.Contains(directoryAdmin)) { @@ -1072,7 +1072,7 @@ namespace Marco.Pms.Services.Helpers List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); foreach (var bucket in bucketList) { - List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + List employeeBucketMappings = employeeBucketVM.Where(eb => eb.BucketId == bucket.Id).ToList(); var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); -- 2.43.0 From 3a37cfdf37111c87fc968bc7a26bd74009174110 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 31 May 2025 19:01:13 +0530 Subject: [PATCH 269/469] Resloved conflicts --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 90380ac..d34b0d3 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -87,8 +87,6 @@ namespace Marco.Pms.Services.Helpers contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); } - - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); @@ -181,7 +179,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -461,7 +458,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -695,19 +691,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 681cdd690ce4e36d7827d7a89584321dd050b86e Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Mon, 9 Jun 2025 09:46:30 +0530 Subject: [PATCH 270/469] created new dto for projectAllocation for employee --- Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs b/Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs index 1634a84..7a1fd91 100644 --- a/Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs +++ b/Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs @@ -8,4 +8,13 @@ public bool Status { get; set; } } + + + public class ProjectsAllocationDto + { + public Guid ProjectId { get; set; } + public Guid JobRoleId { get; set; } + + public bool Status { get; set; } + } } -- 2.43.0 From 280fc922fff97029cfffe68a513a69fefb6dfedd Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Mon, 9 Jun 2025 09:48:35 +0530 Subject: [PATCH 271/469] created two end pointe for assigne and unassign project for perticular employee --- .../Controllers/ProjectController.cs | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/Marco.Pms.Services/Controllers/ProjectController.cs b/Marco.Pms.Services/Controllers/ProjectController.cs index 00ff1c2..f50225f 100644 --- a/Marco.Pms.Services/Controllers/ProjectController.cs +++ b/Marco.Pms.Services/Controllers/ProjectController.cs @@ -13,6 +13,7 @@ using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace MarcoBMS.Services.Controllers { @@ -663,5 +664,122 @@ namespace MarcoBMS.Services.Controllers } + [HttpGet("assigned-projects/{employeeId}")] + public async Task GetProjectsByEmployee([FromRoute] Guid employeeId) + { + + Guid tenantId = _userHelper.GetTenantId(); + if (employeeId == Guid.Empty) + { + return BadRequest(ApiResponse.ErrorResponse("Invalid details.", "Employee id not valid.", 400)); + } + + List projectList = await _context.ProjectAllocations + .Where(c => c.TenantId == tenantId && c.EmployeeId == employeeId && c.IsActive) + .Select(c => c.ProjectId).Distinct() + .ToListAsync(); + + if (!projectList.Any()) + { + return NotFound(ApiResponse.SuccessResponse(new List(), "No projects found.",200)); + } + + + List projectlist = await _context.Projects + .Where(p => projectList.Contains(p.Id)) + .ToListAsync(); + + List projects = new List(); + + + foreach (var project in projectlist) { + + projects.Add(project.ToProjectListVMFromProject()); + } + + + + return Ok(ApiResponse.SuccessResponse(projects, "Success.", 200)); + } + + + + + [HttpPost("assign-projects/{employeeId}")] + public async Task AssigneProjectsToEmployee([FromBody] List projectAllocationDtos, [FromRoute] Guid employeeId) + { + if(projectAllocationDtos != null && employeeId != Guid.Empty) + { + Guid TenentID = GetTenantId(); + List? result = new List(); + + foreach(var projectAllocationDto in projectAllocationDtos) + { + try + { + ProjectAllocation projectAllocation = projectAllocationDto.ToProjectAllocationFromProjectsAllocationDto(TenentID,employeeId); + ProjectAllocation? projectAllocationFromDb = await _context.ProjectAllocations.Where(c => c.EmployeeId == employeeId && c.ProjectId == projectAllocationDto.ProjectId && c.ReAllocationDate == null && c.TenantId == TenentID).SingleOrDefaultAsync(); + + if(projectAllocationFromDb != null) + { + + + _context.ProjectAllocations.Attach(projectAllocationFromDb); + + if (projectAllocationDto.Status) + { + projectAllocationFromDb.JobRoleId = projectAllocation.JobRoleId; ; + projectAllocationFromDb.IsActive = true; + _context.Entry(projectAllocationFromDb).Property(e => e.JobRoleId).IsModified = true; + _context.Entry(projectAllocationFromDb).Property(e => e.IsActive).IsModified = true; + } + else + { + projectAllocationFromDb.ReAllocationDate = DateTime.UtcNow; + projectAllocationFromDb.IsActive = false; + _context.Entry(projectAllocationFromDb).Property(e => e.ReAllocationDate).IsModified = true; + _context.Entry(projectAllocationFromDb).Property(e => e.IsActive).IsModified = true; + } + await _context.SaveChangesAsync(); + var result1 = new + { + Id = projectAllocationFromDb.Id, + EmployeeId = projectAllocation.EmployeeId, + JobRoleId = projectAllocation.JobRoleId, + IsActive = projectAllocation.IsActive, + ProjectId = projectAllocation.ProjectId, + AllocationDate = projectAllocation.AllocationDate, + ReAllocationDate = projectAllocation.ReAllocationDate, + TenantId = projectAllocation.TenantId + }; + result.Add(result1); + } + else + { + projectAllocation.AllocationDate = DateTime.Now; + projectAllocation.IsActive = true; + _context.ProjectAllocations.Add(projectAllocation); + await _context.SaveChangesAsync(); + + } + + + } + catch (Exception ex) { + + return Ok(ApiResponse.ErrorResponse(ex.Message, ex, 400)); + } + } + + return Ok(ApiResponse.SuccessResponse(result, "Data saved successfully", 200)); + } + else + { + return BadRequest(ApiResponse.ErrorResponse("Invalid details.", "All Field is required", 400)); + } + + } + + } } \ No newline at end of file -- 2.43.0 From b74f70144861a16f436dd23602783c092a3bc594 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Mon, 9 Jun 2025 12:16:02 +0530 Subject: [PATCH 272/469] created new DTO for projectsallocation for one specific employee --- Marco.Pms.Model/Mapper/ProjectMapper.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Marco.Pms.Model/Mapper/ProjectMapper.cs b/Marco.Pms.Model/Mapper/ProjectMapper.cs index 75588c5..7211e03 100644 --- a/Marco.Pms.Model/Mapper/ProjectMapper.cs +++ b/Marco.Pms.Model/Mapper/ProjectMapper.cs @@ -61,6 +61,19 @@ namespace Marco.Pms.Model.Mapper }; } + + public static ProjectAllocation ToProjectAllocationFromProjectsAllocationDto(this ProjectsAllocationDto model, Guid TenantId,Guid employeeId) + { + return new ProjectAllocation + { + AllocationDate = DateTime.Now, + EmployeeId = employeeId, + JobRoleId = model.JobRoleId, + TenantId = TenantId, + ProjectId = model.ProjectId + }; + } + public static ProjectListVM ToProjectListVMFromProject(this Project project) { return new ProjectListVM -- 2.43.0 From 2002a79360ba418d90e19bdcbfdedf3b45b2d1f0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 273/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From 2c20d49609b33130ccbea85c3ca6f45e4743648f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 09:51:01 +0000 Subject: [PATCH 274/469] revert c7e89630eb494454c1322bdf4cf29ab076af7b86 revert Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 -- Marco.Pms.Model/Directory/Contact.cs | 31 --- .../Directory/ContactBucketMapping.cs | 18 -- .../Directory/ContactCategoryMaster.cs | 11 -- Marco.Pms.Model/Directory/ContactEmail.cs | 21 --- Marco.Pms.Model/Directory/ContactNote.cs | 25 --- Marco.Pms.Model/Directory/ContactPhone.cs | 22 --- .../Directory/ContactTagMapping.cs | 11 -- Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 -- .../Directory/DirectoryUpdateLog.cs | 18 -- .../Directory/EmployeeBucketMapping.cs | 19 -- .../Dtos/Directory/CreateBucketDto.cs | 8 - .../Dtos/Directory/CreateContactDto.cs | 15 -- .../Dtos/Directory/CreateContactEmailDto.cs | 9 - .../Dtos/Directory/CreateContactNoteDto.cs | 8 - .../Dtos/Directory/CreateContactPhoneDto.cs | 9 - .../Dtos/Directory/UpdateContactDto.cs | 16 -- .../Dtos/Directory/UpdateContactEmailDto.cs | 10 - .../Dtos/Directory/UpdateContactNoteDto.cs | 9 - .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 - .../Dtos/Master/CreateContactCategoryDto.cs | 8 - .../Dtos/Master/CreateContactTagDto.cs | 7 - .../Dtos/Master/UpdateContactCategoryDto.cs | 9 - .../Dtos/Master/UpdateContactTagDto.cs | 8 - Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ------------------ .../ViewModels/Directory/ContactEmailVM.cs | 10 - .../ViewModels/Directory/ContactPhoneVM.cs | 10 - .../ViewModels/Directory/ContactVM.cs | 18 -- .../ViewModels/Master/ContactCategoryVM.cs | 9 - .../ViewModels/Master/ContactTagVM.cs | 8 - 30 files changed, 556 deletions(-) delete mode 100644 Marco.Pms.Model/Directory/Bucket.cs delete mode 100644 Marco.Pms.Model/Directory/Contact.cs delete mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs delete mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs delete mode 100644 Marco.Pms.Model/Directory/ContactNote.cs delete mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs delete mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs delete mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs delete mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs delete mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs delete mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs delete mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs deleted file mode 100644 index 028b428..0000000 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class Bucket : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs deleted file mode 100644 index 87d7698..0000000 --- a/Marco.Pms.Model/Directory/Contact.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class Contact : TenantRelation - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - public string Organization { get; set; } = string.Empty; - public string? Address { get; set; } - public bool IsActive { get; set; } = true; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - - [DisplayName("ContactCategoryId")] - public Guid? ContactCategoryId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactCategoryId))] - public ContactCategoryMaster? ContactCategory { get; set; } - public DateTime CreatedAt { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs deleted file mode 100644 index 9444337..0000000 --- a/Marco.Pms.Model/Directory/ContactBucketMapping.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs deleted file mode 100644 index 8fb1a94..0000000 --- a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactCategoryMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs deleted file mode 100644 index 1eb1b34..0000000 --- a/Marco.Pms.Model/Directory/ContactEmail.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactEmail - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string EmailAddress { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs deleted file mode 100644 index e203f1d..0000000 --- a/Marco.Pms.Model/Directory/ContactNote.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactNote : TenantRelation - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? Createdby { get; set; } - public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - public Guid ContactId { get; set; } - - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs deleted file mode 100644 index d10439b..0000000 --- a/Marco.Pms.Model/Directory/ContactPhone.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactPhone - { - public Guid Id { get; set; } - public string Label { get; set; } = string.Empty; - public string PhoneNumber { get; set; } = string.Empty; - [DisplayName("ContactId")] - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey(nameof(ContactId))] - public Contact? Contact { get; set; } - public bool IsPrimary { get; set; } - - public Guid TenantId { get; set; } - - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs deleted file mode 100644 index a3d7e9e..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMapping - { - public Guid Id { get; set; } - public Guid ContactId { get; set; } - public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } - public ContactTagMaster? ContactTag { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs deleted file mode 100644 index 86eba76..0000000 --- a/Marco.Pms.Model/Directory/ContactTagMaster.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Directory -{ - public class ContactTagMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs deleted file mode 100644 index 91b1b7a..0000000 --- a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class DirectoryUpdateLog - { - public Guid Id { get; set; } - public Guid RefereanceId { get; set; } - public DateTime UpdateAt { get; set; } = DateTime.UtcNow; - public Guid UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs deleted file mode 100644 index db12d3f..0000000 --- a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class EmployeeBucketMapping - { - public Guid Id { get; set; } - public Guid BucketId { get; set; } - [ValidateNever] - [ForeignKey("BucketId")] - public Bucket? Bucket { get; set; } - public Guid EmployeeId { get; set; } - [ValidateNever] - [ForeignKey("EmployeeId")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs deleted file mode 100644 index ba0918d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateBucketDto - { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs deleted file mode 100644 index 42937c0..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactDto - { - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs deleted file mode 100644 index 68bb2b2..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactEmailDto - { - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs deleted file mode 100644 index 1ccaea9..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactNoteDto - { - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs deleted file mode 100644 index dc97881..0000000 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class CreateContactPhoneDto - { - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs deleted file mode 100644 index 042150d..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactDto - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? TagIds { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs deleted file mode 100644 index 8ece036..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactEmailDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs deleted file mode 100644 index 295357a..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactNoteDto - { - public Guid Id { get; set; } - public string Note { get; set; } = string.Empty; - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs deleted file mode 100644 index 1ddfb14..0000000 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Directory -{ - public class UpdateContactPhoneDto - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs deleted file mode 100644 index 3efc443..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactCategoryDto - { - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs deleted file mode 100644 index ad91ca7..0000000 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class CreateContactTagDto - { - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs deleted file mode 100644 index 0bd5cc7..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactCategoryDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs deleted file mode 100644 index 0406a6c..0000000 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Master -{ - public class UpdateContactTagDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs deleted file mode 100644 index 048a0d2..0000000 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ /dev/null @@ -1,177 +0,0 @@ -using Marco.Pms.Model.Directory; -using Marco.Pms.Model.Dtos.Directory; -using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.ViewModels.Directory; -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.Mapper -{ - public static class DirectoryMapper - { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) - { - - return new Contact - { - ProjectId = createContactDto.ProjectId, - Name = createContactDto.Name ?? string.Empty, - ContactCategoryId = createContactDto.ContactCategoryId, - Description = createContactDto.Description ?? string.Empty, - Organization = createContactDto?.Organization ?? string.Empty, - Address = createContactDto != null ? createContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) - { - - return new Contact - { - Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, - Name = updateContactDto.Name ?? string.Empty, - ContactCategoryId = updateContactDto.ContactCategoryId, - Description = updateContactDto.Description ?? string.Empty, - Organization = updateContactDto?.Organization ?? string.Empty, - Address = updateContactDto != null ? updateContactDto.Address : string.Empty, - TenantId = tenantId - }; - } - public static ContactVM ToContactVMFromContact(this Contact contact) - { - return new ContactVM - { - Id = contact.Id, - ProjectId = contact.ProjectId, - Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), - Description = contact.Description ?? string.Empty, - Organization = contact.Organization ?? string.Empty, - Address = contact.Address ?? string.Empty - }; - } - - //Contact Phone Mapper - public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Label = createContactPhoneDto.Label ?? string.Empty, - PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) - { - return new ContactPhone - { - Id = updateContactPhoneDto.Id, - Label = updateContactPhoneDto.Label ?? string.Empty, - PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) - { - return new ContactPhoneVM - { - Id = phone.Id, - Label = phone.Label ?? string.Empty, - PhoneNumber = phone.PhoneNumber ?? string.Empty, - ContactId = phone.ContactId - }; - } - - //Contact Email Mapper - public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Label = createContactEmailDto.Label ?? string.Empty, - EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) - { - return new ContactEmail - { - Id = updateContactEmailDto.Id, - Label = updateContactEmailDto.Label ?? string.Empty, - EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, - ContactId = contactId, - TenantId = tenantId - }; - } - public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) - { - return new ContactEmailVM - { - Id = email.Id, - Label = email.Label ?? string.Empty, - EmailAddress = email.EmailAddress ?? string.Empty, - ContactId = email.ContactId - }; - } - - //Contact Tag Mapper - public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Name = createContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) - { - return new ContactTagMaster - { - Id = updateContactTagDto.Id, - Name = updateContactTagDto.Name ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) - { - return new ContactTagVM - { - Id = contactTag.Id, - Name = contactTag.Name ?? string.Empty, - }; - } - - //Contact Category Mapper - public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Name = createContactTypeDto.Name ?? string.Empty, - Description = createContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) - { - return new ContactCategoryMaster - { - Id = updateContactTypeDto.Id, - Name = updateContactTypeDto.Name ?? string.Empty, - Description = updateContactTypeDto.Description ?? string.Empty, - TenantId = tenantId - }; - } - public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) - { - return new ContactCategoryVM - { - Id = contactType.Id, - Name = contactType.Name ?? string.Empty, - Description = contactType.Description ?? string.Empty, - }; - } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs deleted file mode 100644 index 476e44d..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactEmailVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? EmailAddress { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs deleted file mode 100644 index 1dc7672..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactPhoneVM - { - public Guid Id { get; set; } - public string? Label { get; set; } - public string? PhoneNumber { get; set; } - public Guid ContactId { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs deleted file mode 100644 index 6d6f82e..0000000 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Marco.Pms.Model.ViewModels.Master; - -namespace Marco.Pms.Model.ViewModels.Directory -{ - public class ContactVM - { - public Guid Id { get; set; } - public Guid? ProjectId { get; set; } - public string? Name { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } - public string? Description { get; set; } - public string? Organization { get; set; } - public string? Address { get; set; } - public List? Tags { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs deleted file mode 100644 index eb08d89..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactCategoryVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs deleted file mode 100644 index 2cb6f8a..0000000 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Master -{ - public class ContactTagVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - } -} -- 2.43.0 From 004bb94d9970cce7813e6aa439e37b0b4128018d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:27:36 +0530 Subject: [PATCH 275/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} -- 2.43.0 From 58c73383b2b0c8bfc4f930926f2e006a1430c313 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:38:47 +0530 Subject: [PATCH 276/469] Added Directory controller file --- Marco.Pms.Services/Controllers/DirectoryController.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Marco.Pms.Services/Controllers/DirectoryController.cs diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs new file mode 100644 index 0000000..77a183c --- /dev/null +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Marco.Pms.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class DirectoryController : ControllerBase + { + } +} -- 2.43.0 From 5932a21fcce297f5173ed1ee45778c52e1032616 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:44:30 +0530 Subject: [PATCH 277/469] An API skeleton has been added. --- .../Controllers/DirectoryController.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 77a183c..b0de798 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,4 +1,8 @@ -using Microsoft.AspNetCore.Mvc; +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Dtos.Directory; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { @@ -6,5 +10,32 @@ namespace Marco.Pms.Services.Controllers [ApiController] public class DirectoryController : ControllerBase { + + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + + [HttpGet] + public async Task GetContactList() + { + return Ok(); + } + + [HttpPost] + public async Task CreateContact([FromBody] CreateContactDto createContact) + { + return Ok(); + } + { + return Ok(); } } +} -- 2.43.0 From 73df47e540f9f494217c8e09d8a25d5c475decbb Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 16:10:07 +0530 Subject: [PATCH 278/469] Added Migration for contact related tables --- .../Data/ApplicationDbContext.cs | 13 + ...Added_Directory_Related_Tables.Designer.cs | 2990 +++++++++++++++++ ...14103249_Added_Directory_Related_Tables.cs | 440 +++ .../ApplicationDbContextModelSnapshot.cs | 479 +++ Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- 5 files changed, 3923 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index d5f05c0..a626ce1 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -2,6 +2,7 @@ using Marco.Pms.Model.Activities; using Marco.Pms.Model.AttendanceModule; using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.DocumentManager; using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; @@ -67,6 +68,18 @@ namespace Marco.Pms.DataAccess.Data public DbSet Documents { get; set; } public DbSet TicketTags { get; set; } public DbSet WorkCategoryMasters { get; set; } + public DbSet Contacts { get; set; } + public DbSet ContactCategoryMasters { get; set; } + public DbSet ContactsEmails { get; set; } + public DbSet ContactsPhones { get; set; } + public DbSet ContactNotes { get; set; } + public DbSet Buckets { get; set; } + public DbSet ContactTagMasters { get; set; } + public DbSet ContactTagMappings { get; set; } + public DbSet EmployeeBucketMappings { get; set; } + public DbSet ContactBucketMappings { get; set; } + public DbSet DirectoryUpdateLogs { get; set; } + public DbSet MailingList { get; set; } public DbSet MailDetails { get; set; } public DbSet MailLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs new file mode 100644 index 0000000..f50346e --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -0,0 +1,2990 @@ +// +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("20250514103249_Added_Directory_Related_Tables")] + partial class Added_Directory_Related_Tables + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs new file mode 100644 index 0000000..879f54b --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -0,0 +1,440 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_Directory_Related_Tables : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Buckets", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Buckets", x => x.Id); + table.ForeignKey( + name: "FK_Buckets_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactCategoryMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactCategoryMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactCategoryMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMasters", + 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: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMasters", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "DirectoryUpdateLogs", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + RefereanceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + UpdateAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_DirectoryUpdateLogs", x => x.Id); + table.ForeignKey( + name: "FK_DirectoryUpdateLogs_Employees_UpdatedById", + column: x => x.UpdatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "EmployeeBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_EmployeeBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EmployeeBucketMappings_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Contacts", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: true, 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"), + Organization = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Address = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactCategoryId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Contacts", x => x.Id); + table.ForeignKey( + name: "FK_Contacts_ContactCategoryMasters_ContactCategoryId", + column: x => x.ContactCategoryId, + principalTable: "ContactCategoryMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Contacts_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contacts_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactBucketMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + BucketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactBucketMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactBucketMappings_Buckets_BucketId", + column: x => x.BucketId, + principalTable: "Buckets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactBucketMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactNotes", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactNotes", x => x.Id); + table.ForeignKey( + name: "FK_ContactNotes_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Employees_CreatedById", + column: x => x.CreatedById, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactNotes_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsEmails", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmailAddress = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsEmails", x => x.Id); + table.ForeignKey( + name: "FK_ContactsEmails_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactsPhones", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Label = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactsPhones", x => x.Id); + table.ForeignKey( + name: "FK_ContactsPhones_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ContactTagMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactTagMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + column: x => x.ContactTagId, + principalTable: "ContactTagMasters", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ContactTagMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_TenantId", + table: "Buckets", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_BucketId", + table: "ContactBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactBucketMappings_ContactId", + table: "ContactBucketMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactCategoryMasters_TenantId", + table: "ContactCategoryMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_ContactId", + table: "ContactNotes", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_CreatedById", + table: "ContactNotes", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContactNotes_TenantId", + table: "ContactNotes", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_ContactCategoryId", + table: "Contacts", + column: "ContactCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_CreatedById", + table: "Contacts", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_TenantId", + table: "Contacts", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsEmails_ContactId", + table: "ContactsEmails", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactsPhones_ContactId", + table: "ContactsPhones", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactId", + table: "ContactTagMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMappings_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactTagMasters_TenantId", + table: "ContactTagMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DirectoryUpdateLogs_UpdatedById", + table: "DirectoryUpdateLogs", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_BucketId", + table: "EmployeeBucketMappings", + column: "BucketId"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeBucketMappings_EmployeeId", + table: "EmployeeBucketMappings", + column: "EmployeeId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactNotes"); + + migrationBuilder.DropTable( + name: "ContactsEmails"); + + migrationBuilder.DropTable( + name: "ContactsPhones"); + + migrationBuilder.DropTable( + name: "ContactTagMappings"); + + migrationBuilder.DropTable( + name: "DirectoryUpdateLogs"); + + migrationBuilder.DropTable( + name: "EmployeeBucketMappings"); + + migrationBuilder.DropTable( + name: "ContactTagMasters"); + + migrationBuilder.DropTable( + name: "Contacts"); + + migrationBuilder.DropTable( + name: "Buckets"); + + migrationBuilder.DropTable( + name: "ContactCategoryMasters"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index fcc64ac..9d70475 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -325,6 +325,312 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("RefreshTokens"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.Property("Id") @@ -2212,6 +2518,179 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("User"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => { b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 048a0d2..d66615a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty -- 2.43.0 From 38babea9d5dc99d28ceb58ddd376430a994f7fd1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 17:51:57 +0530 Subject: [PATCH 279/469] Added DirectoryHelper in helper folder --- .../Dtos/Directory/CreateContactDto.cs | 3 +- .../Dtos/Directory/UpdateContactDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 ++- .../Controllers/DirectoryController.cs | 34 ++++++++++++------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 21 ++++++++++++ Marco.Pms.Services/Program.cs | 2 ++ 6 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 Marco.Pms.Services/Helpers/DirectoryHelper.cs diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 42937c0..6e962a4 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -6,7 +6,8 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } + public List? BucketIds { get; set; } + public Guid? ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 042150d..7c93cce 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -7,6 +7,7 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } + public List? BucketIds { get; set; } public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index d66615a..abf72d3 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -8,7 +8,7 @@ namespace Marco.Pms.Model.Mapper { public static class DirectoryMapper { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId, Guid employeeId) { return new Contact @@ -19,6 +19,8 @@ namespace Marco.Pms.Model.Mapper Description = createContactDto.Description ?? string.Empty, Organization = createContactDto?.Organization ?? string.Empty, Address = createContactDto != null ? createContactDto.Address : string.Empty, + CreatedById = employeeId, + CreatedAt = DateTime.UtcNow, TenantId = tenantId }; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b0de798..a2f984c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,26 +1,25 @@ -using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Dtos.Directory; -using MarcoBMS.Services.Helpers; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { - [Route("api/[controller]")] [ApiController] + [Route("api/[controller]")] + public class DirectoryController : ControllerBase { - private readonly ApplicationDbContext _context; + private readonly DirectoryHelper _directoryHelper; private readonly ILoggingService _logger; - private readonly UserHelper _userHelper; - public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + public DirectoryController(DirectoryHelper directoryHelper, ILoggingService logger) { - _context = context; + _directoryHelper = directoryHelper; _logger = logger; - _userHelper = userHelper; } [HttpGet] @@ -32,10 +31,21 @@ namespace Marco.Pms.Services.Controllers [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + return Ok(); } - { - return Ok(); + + + + } } -} diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs new file mode 100644 index 0000000..832d190 --- /dev/null +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -0,0 +1,21 @@ +using Marco.Pms.DataAccess.Data; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; + +namespace Marco.Pms.Services.Helpers +{ + public class DirectoryHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index 7f98d54..2ca6636 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -3,6 +3,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Authentication; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using Marco.Pms.Services.Service; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Middleware; @@ -131,6 +132,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From 278a55ebe358f7dc52c5a9760243183fa19ba3e2 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 280/469] created GetListOfContact custome function --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../ViewModels/Directory/ContactVM.cs | 2 +- .../Controllers/DirectoryController.cs | 13 ++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 92 ++++++++++++++++++- 4 files changed, 105 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index abf72d3..fbe0e46 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index 6d6f82e..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.ViewModels.Directory public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a2f984c..efa76c3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,7 +25,18 @@ namespace Marco.Pms.Services.Controllers [HttpGet] public async Task GetContactList() { - return Ok(); + var response = await _directoryHelper.GetListOfContacts(); + + + if(response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 832d190..5e11587 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,6 +1,12 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; namespace Marco.Pms.Services.Helpers { @@ -17,5 +23,89 @@ namespace Marco.Pms.Services.Helpers _logger = logger; _userHelper = userHelper; } + + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + + List contactIds = contacts.Select(c=>c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); + + var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); + + + List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if(emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if(phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + + if (tagMappingss != null) { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag.ToContactTagVMFromContactTagMaster(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + + return ApiResponse.SuccessResponse(list, "Contact List !",200); + + } } -} + } -- 2.43.0 From f26d5d00218e9a2bfb798ce96c7b866e445ae879 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 281/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 2 +- .../Dtos/Directory/CreateContactPhoneDto.cs | 1 - .../Controllers/DirectoryController.cs | 11 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 110 ++++++++++++++++++ 4 files changed, 120 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 68bb2b2..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,6 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } } } + diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index dc97881..a72ac3d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,6 +4,5 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index efa76c3..afcb061 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -51,8 +51,15 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("User sent Invalid Date while marking attendance"); return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); } - - return Ok(); + var response = await _directoryHelper.CreateContact(createContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5e11587..b1f6e9c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1,5 +1,6 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; @@ -107,5 +108,114 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, "Contact List !",200); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } -- 2.43.0 From d5e150d768689a2c61ccfea726280596bc64a599 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 282/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 84 ------------------- 1 file changed, 84 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b1f6e9c..7ac80c4 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -25,90 +25,6 @@ namespace Marco.Pms.Services.Helpers _userHelper = userHelper; } - - - public async Task> GetListOfContacts() - { - Guid tenantId = _userHelper.GetTenantId(); - - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - - List contactIds = contacts.Select(c=>c.Id).ToList(); - - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - - var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); - - var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); - - - List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); - - var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); - - List list = new List(); - - foreach (var contact in contacts) - { - - ContactVM contactVM = new ContactVM(); - List contactEmailVms = new List(); - List contactPhoneVms = new List(); - - List conatctTagVms = new List(); - var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); - var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); - var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - - - if(emails != null) - { - foreach (var email in emails) - { - ContactEmailVM emailVM = new ContactEmailVM(); - emailVM = email.ToContactEmailVMFromContactEmail(); - contactEmailVms.Add(emailVM); - } - } - - if(phones != null) - { - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = new ContactPhoneVM(); - phoneVM = phone.ToContactPhoneVMFromContactPhone(); - contactPhoneVms.Add(phoneVM); - } - - } - - if (tagMappingss != null) { - foreach (var tagMapping in tagMappingss) - { - ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); - - tagVM = tag.ToContactTagVMFromContactTagMaster(); - conatctTagVms.Add(tagVM); - - - } - } - - - contactVM = contact.ToContactVMFromContact(); - - contactVM.ContactEmails = contactEmailVms; - contactVM.ContactPhones = contactPhoneVms; - contactVM.Tags = conatctTagVms; - - list.Add(contactVM); - } - - return ApiResponse.SuccessResponse(list, "Contact List !",200); - - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 7dffdc4c25b1026fc0df0ce6fbe96702b5ca4ffa Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 283/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../Controllers/DirectoryController.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 81 ++++++++++++++++++- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index fbe0e46..b9e9f86 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index afcb061..b5ac7e5 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -2,12 +2,14 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { [ApiController] [Route("api/[controller]")] + [Authorize] public class DirectoryController : ControllerBase { @@ -28,7 +30,7 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetListOfContacts(); - if(response.StatusCode == 200) + if (response.StatusCode == 200) { return Ok(response); } @@ -36,7 +38,7 @@ namespace Marco.Pms.Services.Controllers { return BadRequest(response); } - + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 7ac80c4..c34d2ac 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -25,6 +25,85 @@ namespace Marco.Pms.Services.Helpers _userHelper = userHelper; } + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); + var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if (emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if (phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + if (tagMappingss != null) + { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + _logger.LogInfo("{count} contacts are fetched by Employee with ID {LoggedInEmployeeId}", list.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); + + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -134,4 +213,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From bb0c2acc87f9e346f2f7d0362da131d7e57fa1db Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 12:51:23 +0530 Subject: [PATCH 284/469] Created an API to create the Contact category --- .../Dtos/Master/CreateContactTagDto.cs | 1 + .../Dtos/Master/UpdateContactTagDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Master/ContactTagVM.cs | 1 + .../Controllers/MasterController.cs | 81 ++++++++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 54 +++++++++++++ Marco.Pms.Services/Program.cs | 1 + 7 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Services/Helpers/MasterHelper.cs diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs index ad91ca7..2fec4ae 100644 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -3,5 +3,6 @@ public class CreateContactTagDto { public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs index 0406a6c..e97ece6 100644 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b9e9f86..82e703f 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -125,6 +125,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagMaster { Name = createContactTagDto.Name ?? string.Empty, + Description = createContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -134,6 +135,7 @@ namespace Marco.Pms.Model.Mapper { Id = updateContactTagDto.Id, Name = updateContactTagDto.Name ?? string.Empty, + Description = updateContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -142,6 +144,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagVM { Id = contactTag.Id, + Description = contactTag.Description ?? string.Empty, Name = contactTag.Name ?? string.Empty, }; } diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs index 2cb6f8a..321b669 100644 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index b89dc91..0d0221b 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -9,6 +9,7 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Activities; using Marco.Pms.Model.ViewModels.Forum; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Authorization; @@ -25,11 +26,13 @@ namespace Marco.Pms.Services.Controllers private readonly ApplicationDbContext _context; private readonly UserHelper _userHelper; private readonly ILoggingService _logger; - public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger) + private readonly MasterHelper _masterHelper; + public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger, MasterHelper masterHelper) { _context = context; _userHelper = userHelper; _logger = logger; + _masterHelper = masterHelper; } // -------------------------------- Activity -------------------------------- @@ -667,5 +670,81 @@ namespace Marco.Pms.Services.Controllers return NotFound(ApiResponse.ErrorResponse("Work category not found", "Work category not found", 404)); } } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-categories")] + public async Task GetContactCategoryMasterList() + { + return Ok(); + } + + [HttpGet("contact-category/{id})")] + public async Task GetContactCategoryMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-category")] + public async Task CreateContactCategoryMaster([FromBody] CreateContactCategoryDto contactCategoryDto) + { + var response = await _masterHelper.CreateContactCategory(contactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPost("contact-category/edit/{id}")] + public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) + { + return Ok(); + } + + [HttpDelete("contact-category/{id}")] + public async Task DeletecontactCategoryMaster(Guid id) + { + return Ok(); + } + + // -------------------------------- Contact Category -------------------------------- + + [HttpGet("contact-tags")] + public async Task GetContactTagMasterList() + { + return Ok(); + } + + [HttpGet("contact-tag/{id})")] + public async Task GetContactTagMaster(Guid id) + { + return Ok(); + } + + [HttpPost("contact-tag")] + public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) + { + return Ok(); + } + + [HttpPost("contact-tag/edit/{id}")] + public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) + { + return Ok(); + } + + [HttpDelete("contact-tag/{id}")] + public async Task DeletecontactTagMaster(Guid id) + { + return Ok(); + } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs new file mode 100644 index 0000000..893eee2 --- /dev/null +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -0,0 +1,54 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Master; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; + +namespace Marco.Pms.Services.Helpers +{ + public class MasterHelper + { + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public MasterHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + // -------------------------------- Contact Category -------------------------------- + public async Task> CreateContactCategory(CreateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactCategoryDto.Name != null ? contactCategoryDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactCategoryMaster contactCategory = contactCategoryDto.ToContactCategoryMasterFromCreateContactCategoryDto(tenantId); + _context.ContactCategoryMasters.Add(contactCategory); + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact category.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category already existed", "Category already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + // -------------------------------- Contact Tag -------------------------------- + // -------------------------------- Bucket -------------------------------- + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs index 2ca6636..e57fa15 100644 --- a/Marco.Pms.Services/Program.cs +++ b/Marco.Pms.Services/Program.cs @@ -133,6 +133,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); -- 2.43.0 From 3043a3f7ed72c178289e8f34f3c19a17d2b2616d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 285/469] Created an endpoint to fetch list of all contact category in that tenant --- .../Controllers/MasterController.cs | 5 +++-- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 0d0221b..fe0f1e9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -676,7 +676,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-categories")] public async Task GetContactCategoryMasterList() { - return Ok(); + var response = await _masterHelper.GetContactCategoriesList(); + return Ok(response); } [HttpGet("contact-category/{id})")] @@ -715,7 +716,7 @@ namespace Marco.Pms.Services.Controllers return Ok(); } - // -------------------------------- Contact Category -------------------------------- + // -------------------------------- Contact Tag -------------------------------- [HttpGet("contact-tags")] public async Task GetContactTagMasterList() diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 893eee2..75c6d5f 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -48,6 +48,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- // -------------------------------- Bucket -------------------------------- } -- 2.43.0 From ecc8c6d8016aeff33a56707dc13b071cfb975dfc Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 286/469] Added an API to update existing contact --- .../Dtos/Directory/ContactTagDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactEmailDto.cs | 2 +- .../Dtos/Directory/UpdateContactPhoneDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +- .../Controllers/DirectoryController.cs | 18 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 8 files changed, 258 insertions(+), 13 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs new file mode 100644 index 0000000..12b0223 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactTagDto + { + public Guid? Id { get; set; } + public string Name { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 6e962a4..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -11,6 +11,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 7c93cce..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -12,6 +12,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs index 8ece036..186f5b3 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactEmailDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? EmailAddress { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs index 1ddfb14..ff0ec23 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactPhoneDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? PhoneNumber { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 82e703f..9b5c835 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -68,7 +68,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactPhone { - Id = updateContactPhoneDto.Id, + Id = updateContactPhoneDto.Id ?? Guid.Empty, Label = updateContactPhoneDto.Label ?? string.Empty, PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, ContactId = contactId, @@ -101,7 +101,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactEmail { - Id = updateContactEmailDto.Id, + Id = updateContactEmailDto.Id ?? Guid.Empty, Label = updateContactEmailDto.Label ?? string.Empty, EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, ContactId = contactId, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b5ac7e5..fe82bce 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -64,7 +64,23 @@ namespace Marco.Pms.Services.Controllers } } - + [HttpPut("{id}")] + public async Task UpdateContact(Guid id, [FromBody] UpdateContactDto updateContact) + { + var response = await _directoryHelper.UpdateContact(id, updateContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c34d2ac..81f419c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -162,17 +162,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -209,8 +224,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From 967488e9c1b825306edb95868554790523bde808 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 287/469] added api to get list of contact tag --- .../Controllers/MasterController.cs | 3 ++- Marco.Pms.Services/Helpers/MasterHelper.cs | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index fe0f1e9..4df3a62 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -721,7 +721,8 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-tags")] public async Task GetContactTagMasterList() { - return Ok(); + var response = await _masterHelper.GetContactTags(); + return Ok(response); } [HttpGet("contact-tag/{id})")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 75c6d5f..ca1bbde 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -65,6 +66,23 @@ namespace Marco.Pms.Services.Helpers } // -------------------------------- Contact Tag -------------------------------- + + + public async Task> GetContactTags() + { + Guid tenantId = _userHelper.GetTenantId(); + + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + List contactTags = new List(); + foreach (var tag in taglist) { + ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); + contactTags.Add(tagVm); + } + _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + } // -------------------------------- Bucket -------------------------------- } } -- 2.43.0 From 532e0ff16df795367f58146bda524f82995014c0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 288/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 11 ++++++++++ .../ViewModels/Directory/BucketVM.cs | 9 ++++++++ .../Controllers/DirectoryController.cs | 6 +++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/BucketVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 9b5c835..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -178,5 +178,16 @@ namespace Marco.Pms.Model.Mapper Description = contactType.Description ?? string.Empty, }; } + + // Bucket + public static BucketVM ToBucketVMFromBucket(this Bucket bucket) + { + return new BucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs new file mode 100644 index 0000000..ce9ed9e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class BucketVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fe82bce..65ccd2d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -83,5 +83,11 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("buckets")] + public async Task GetBucketList() + { + var response = await _directoryHelper.GetBucketList(); + return Ok(response); + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 81f419c..5d8e0b7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -433,5 +433,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From e049b6c996f236507acf627c0a400d00df8d378c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 289/469] Added an API to create a contact tag --- .../Controllers/MasterController.cs | 23 ++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 34 ++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 4df3a62..8e4a86f 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -734,7 +734,28 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag")] public async Task CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto) { - return Ok(); + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _masterHelper.CreateContactTag(contactTagDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-tag/edit/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ca1bbde..1906ec2 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; @@ -76,13 +75,38 @@ namespace Marco.Pms.Services.Helpers var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); List contactTags = new List(); - foreach (var tag in taglist) { + foreach (var tag in taglist) + { ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster(); contactTags.Add(tagVm); } _logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200); + return ApiResponse.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count), 200); } - // -------------------------------- Bucket -------------------------------- + public async Task> CreateContactTag(CreateContactTagDto contactTagDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null) + { + ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactCategory == null) + { + ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); + _context.ContactTagMasters.Add(contactTag); + await _context.SaveChangesAsync(); + ContactTagVM tagVM = contactTag.ToContactTagVMFromContactTagMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact tag {ContactTagId}.", LoggedInEmployee.Id, contactTag.Id); + return ApiResponse.SuccessResponse(tagVM, "Tag Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact tag.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Tag already existed", "Tag already existed", 409); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + } } -- 2.43.0 From d52956abd920f85ae367cd01d54c3299dc79d6b1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:38:24 +0530 Subject: [PATCH 290/469] Fixed the errorof finding tag in wrong table --- Marco.Pms.Services/Helpers/MasterHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 1906ec2..66d3b45 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -89,8 +89,8 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (contactTagDto != null) { - ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); - if (existingContactCategory == null) + ContactTagMaster? existingContactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactTagDto.Name != null ? contactTagDto.Name.ToLower() : "")); + if (existingContactTag == null) { ContactTagMaster contactTag = contactTagDto.ToContactTagMasterFromCreateContactTagDto(tenantId); _context.ContactTagMasters.Add(contactTag); -- 2.43.0 From 49bbd87a3da74668490ffef4b48ca95889c55c9c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 291/469] Added an API to create bucket --- .../Dtos/Directory/CreateBucketDto.cs | 4 +- .../Controllers/DirectoryController.cs | 28 ++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs index ba0918d..0c02457 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -2,7 +2,7 @@ { public class CreateBucketDto { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 65ccd2d..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -89,5 +89,33 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetBucketList(); return Ok(response); } + + [HttpPost("bucket")] + public async Task CreateBucket(CreateBucketDto bucketDto) + { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _directoryHelper.CreateBucket(bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5d8e0b7..704a0d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -455,5 +455,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From 0a59f87b84a2ba9f12575367a670ddc5caf33a4a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 292/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 704a0d0..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -377,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 999f9168c27c048ec38f3a6d19e91976a0d90494 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 293/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3415 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index a626ce1..2bc92ef 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet MailingList { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 9d70475..32fd7fe 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -382,9 +382,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -540,6 +537,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2633,6 +2656,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..46d0482 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..aa1ef35 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,6 +41,24 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From e89036359d51d3d3189e70ba3f8348dd12819349 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 294/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 23 insertions(+), 3415 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 2bc92ef..a626ce1 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet MailingList { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 32fd7fe..9d70475 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -382,6 +382,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -537,32 +540,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2656,33 +2633,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -42,6 +44,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index aa1ef35..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,24 +41,6 @@ namespace Marco.Pms.Services.Controllers } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..a218ba2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,19 +31,13 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - - List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -61,10 +55,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -74,7 +67,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -84,7 +77,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -97,17 +90,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -119,102 +104,6 @@ namespace Marco.Pms.Services.Helpers } - public async Task> GetContactsListByBucketId(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); - if (employeeBucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); - } - List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); - List contactVMs = new List(); - if (contactBucket.Count > 0) - { - var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); - List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); - List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); - - List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); - List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - - List tagIds = new List(); - List tagMasters = new List(); - if (tags.Count > 0) - { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); - tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - } - - if (contacts.Count > 0) - { - - - foreach (var contact in contacts) - { - List? emailVMs = new List(); - List? phoneVMs = new List(); - List? tagVMs = new List(); - - List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); - List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); - - List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); - List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); - List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); - - if (contactPhones.Count > 0) - { - foreach (var phone in contactPhones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - } - if (contactEmails.Count > 0) - { - foreach (var email in contactEmails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - } - if (contactTags.Count > 0) - { - foreach (var contactTag in contactTags) - { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); - if (tagMaster != null) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - } - } - ContactVM contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = emailVMs; - contactVM.ContactPhones = phoneVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - contactVMs.Add(contactVM); - } - } - - } - _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -234,8 +123,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -258,7 +145,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -274,29 +160,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -314,8 +179,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -326,20 +190,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -365,8 +221,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -385,7 +239,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -405,9 +259,6 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -495,33 +346,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } - if (updateContact.ProjectIds != null) - { - foreach (var ProjectId in updateContact.ProjectIds) - { - if (!projectIds.Contains(ProjectId)) - { - _context.ContactProjectMappings.Add(new ContactProjectMapping - { - ProjectId = ProjectId, - ContactId = contact.Id - }); - } - } - - foreach (var projectMapping in contactProjects) - { - if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) - { - _context.ContactProjectMappings.Remove(projectMapping); - } - } - } - else if (contactProjects != null) - { - _context.ContactProjectMappings.RemoveRange(contactProjects); - } - if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -540,8 +364,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -554,7 +377,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -576,10 +399,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -608,9 +427,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From fe0d5e84581eb66f5543695153492a5e9f9b5e3e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 295/469] Added an API to delete existing contact category --- .../Controllers/MasterController.cs | 3 +- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 8e4a86f..e782913 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -713,7 +713,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-category/{id}")] public async Task DeletecontactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactCategory(id); + return Ok(response); } // -------------------------------- Contact Tag -------------------------------- diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 66d3b45..33fab6b 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -63,6 +63,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From e427781ad9ea45561a8141e1a216894d9283911a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 296/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...63809_Added_ContactProjectMapping_Table.cs | 81 + .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 + .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 17 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 3414 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index a626ce1..3b38c0b 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -79,6 +79,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet MailingList { get; set; } public DbSet MailDetails { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..18a4be6 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517063809_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 9d70475..32fd7fe 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -382,9 +382,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -540,6 +537,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2633,6 +2656,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..bd49e18 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -40,6 +40,23 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a218ba2..883ab63 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,13 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -55,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -67,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -77,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -90,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -104,6 +119,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -123,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -145,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -160,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -179,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -190,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -221,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -239,7 +385,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -259,6 +405,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -346,6 +495,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -364,7 +540,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -377,7 +554,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -399,6 +576,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -427,6 +608,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 33768125386a13c3fc3c2e5d39fa60dbcdb2b466 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:28:54 +0530 Subject: [PATCH 297/469] Refetched the contact in update contact API --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..ff3f730 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -393,6 +393,7 @@ namespace Marco.Pms.Services.Helpers } var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + _context.Contacts.Update(newContact); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -573,6 +574,7 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 20eaccef041e55eaa28ceb4cff7ce1ceb977e96a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 298/469] properly mapped the updated Dto to contact table --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..f78c260 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -23,7 +23,7 @@ namespace Marco.Pms.Model.Mapper TenantId = tenantId }; } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId, Contact contact) { return new Contact @@ -31,6 +31,8 @@ namespace Marco.Pms.Model.Mapper Id = updateContactDto.Id, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, + CreatedAt = contact.CreatedAt, + CreatedById = contact.CreatedById, Description = updateContactDto.Description ?? string.Empty, Organization = updateContactDto?.Organization ?? string.Empty, Address = updateContactDto != null ? updateContactDto.Address : string.Empty, diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ff3f730..f1100c6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -385,15 +385,16 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.AsNoTracking().FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); + await _context.SaveChangesAsync(); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -505,7 +506,8 @@ namespace Marco.Pms.Services.Helpers _context.ContactProjectMappings.Add(new ContactProjectMapping { ProjectId = ProjectId, - ContactId = contact.Id + ContactId = contact.Id, + TenantId = tenantId }); } } @@ -572,7 +574,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 15c665236bd97027008c98bb430b727d3f6bf0ea Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 299/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f1100c6..d866509 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -36,7 +36,7 @@ namespace Marco.Pms.Services.Helpers List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); @@ -118,7 +118,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -233,6 +232,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); @@ -301,14 +301,14 @@ namespace Marco.Pms.Services.Helpers { foreach (var tag in createContact.Tags) { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) + if (tagNames.Contains(tag.Name.ToLower())) { - ContactTagMapping tagMapping = new ContactTagMapping + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); + _context.ContactTagMappings.Add(new ContactTagMapping { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); + ContactId = contact.Id, + ContactTagtId = tag.Id ?? existingTag.Id + }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) { @@ -373,7 +373,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -407,10 +406,12 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -530,12 +531,13 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + if (tagNames.Contains(tag.Name.ToLower())) { + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id.Value + ContactTagtId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -574,19 +576,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From f820bedba313286ea0d2ad50b20e2cd1c5044a37 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 14:33:14 +0530 Subject: [PATCH 300/469] Added an API to deleted ContactTag as well remove entries in contact-tag mapping table related to that tag --- .../Controllers/MasterController.cs | 7 ++--- Marco.Pms.Services/Helpers/MasterHelper.cs | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index e782913..1ba1ee9 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -680,7 +680,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-category/{id})")] + [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { return Ok(); @@ -726,7 +726,7 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } - [HttpGet("contact-tag/{id})")] + [HttpGet("contact-tag/{id}")] public async Task GetContactTagMaster(Guid id) { return Ok(); @@ -768,7 +768,8 @@ namespace Marco.Pms.Services.Controllers [HttpDelete("contact-tag/{id}")] public async Task DeletecontactTagMaster(Guid id) { - return Ok(); + var response = await _masterHelper.DeleteContactTag(id); + return Ok(response); } } } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 33fab6b..ac05b97 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -139,7 +139,33 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactTag(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactTag != null) + { + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + _context.ContactTagMasters.Remove(contactTag); + if (tagMappings.Any()) + { + _context.ContactTagMappings.RemoveRange(tagMappings); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact tag {ContactTagId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Tag {ContactTagId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Tag deleted successfully", 200); + } } } -- 2.43.0 From dc36cb57f4719b0c16c79ae1887afbbc701b85fd Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:13:35 +0530 Subject: [PATCH 301/469] added an API to get a list of contact-notes by contact ID --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 22 ++++++ .../ViewModels/Directory/ContactNoteVM.cs | 9 +++ .../Controllers/DirectoryController.cs | 67 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 +++++++ 4 files changed, 121 insertions(+) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index f78c260..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -188,5 +188,27 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + + //Contact Note + public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) + { + return new ContactNote + { + Note = noteDto.Note, + ContactId = noteDto.ContactId, + CreatedAt = DateTime.UtcNow, + CreatedById = employeeId, + TenantId = tenantId + }; + } + public static ContactNoteVM ToContactNoteVMFromContactNote(this ContactNote note) + { + return new ContactNoteVM + { + Id = note.Id, + Note = note.Note, + ContactId = note.ContactId + }; + } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs new file mode 100644 index 0000000..5e1c340 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactNoteVM + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index bd49e18..dd3785e 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,73 @@ namespace Marco.Pms.Services.Controllers } } + // -------------------------------- Contact Notes -------------------------------- + + [HttpPost("note")] + public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.CreateContactNote(noteDto); + //if (response.StatusCode == 200) + //{ + //return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpGet("note/{ContactId}")] + public async Task GetNoteListByContactId(Guid contactId) + { + var response = await _directoryHelper.GetNoteListByContactId(contactId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPut("note/{id}")] + public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.UpdateContactNote(id, noteDto); + //if (response.StatusCode == 200) + //{ + // return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpDelete("note/{id}")] + public async Task DeleteContactNote(Guid id) + { + return Ok(); + //var response = await _directoryHelper.DeleteContactNote(id); + //return Ok(response); + } + + // -------------------------------- Bucket -------------------------------- [HttpGet("buckets")] public async Task GetBucketList() diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d866509..b68a854 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -624,6 +624,29 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + // -------------------------------- Contact Notes -------------------------------- + + public async Task> GetNoteListByContactId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + noteVMs.Add(noteVM); + } + _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 10625101e150107e4019d692f4ee59b578dfa011 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 302/469] Added an API to get contact category by its size --- .../Controllers/MasterController.cs | 14 +++++++++++++- Marco.Pms.Services/Helpers/MasterHelper.cs | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 1ba1ee9..61baaa3 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -683,7 +683,19 @@ namespace Marco.Pms.Services.Controllers [HttpGet("contact-category/{id}")] public async Task GetContactCategoryMaster(Guid id) { - return Ok(); + var response = await _masterHelper.GetContactCategoryById(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpPost("contact-category")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ac05b97..11015c8 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -47,7 +47,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -63,6 +62,22 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> GetContactCategoryById(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var category = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (category != null) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + _logger.LogInfo("Employee {EmployeeId} fetched contact category {ContactCategoryID}", LoggedInEmployee.Id, category.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category fetched successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} attempted to fetch contact category {ContactCategoryID} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } public async Task> DeleteContactCategory(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From fa3a7ab7f25154102a139aef2ed5d38c328ec51b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 303/469] Added an API to Update existing Contact-note --- .../Controllers/DirectoryController.cs | 60 +++++++++---------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 ++++++++++++ 2 files changed, 67 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index dd3785e..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -104,20 +104,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("note")] public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.CreateContactNote(noteDto); - //if (response.StatusCode == 200) - //{ - //return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + + var response = await _directoryHelper.CreateContactNote(noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpGet("note/{ContactId}")] @@ -141,28 +141,26 @@ namespace Marco.Pms.Services.Controllers [HttpPut("note/{id}")] public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.UpdateContactNote(id, noteDto); - //if (response.StatusCode == 200) - //{ - // return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + var response = await _directoryHelper.UpdateContactNote(id, noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("note/{id}")] public async Task DeleteContactNote(Guid id) { - return Ok(); - //var response = await _directoryHelper.DeleteContactNote(id); - //return Ok(response); + var response = await _directoryHelper.DeleteContactNote(id); + return Ok(response); } // -------------------------------- Bucket -------------------------------- diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b68a854..a185a1d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -647,6 +647,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From ec1325dc0396e0486be450e6a55e7bd4e8590e74 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 304/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a185a1d..9861a15 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -684,6 +684,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 33e765558c1e7c4dc22db564abd1950942c4fa94 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:43 +0530 Subject: [PATCH 305/469] Added an API to add a note to specific contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9861a15..ebaeb4e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -646,7 +646,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - + public async Task> CreateContactNote(CreateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote note = noteDto.ToContactNoteFromCreateContactNoteDto(tenantId, LoggedInEmployee.Id); + _context.ContactNotes.Add(note); + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + _logger.LogInfo("Employee {EmployeeId} Added note at contact {ContactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note added successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to add a note to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 542701f3421ccac86550ad6c56333deff9b538c4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 306/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..12951b9 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -29,6 +29,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, -- 2.43.0 From 1f2cc2b2e657bfcb0e95e07bc93cb85083651498 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 307/469] created GetListOfContact custome function --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ebaeb4e..6ee029b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -787,4 +787,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } -} + } -- 2.43.0 From 81992f6abdc4482b540ddb802e648ad3553263c4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 308/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 6ee029b..e197d31 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -786,5 +786,114 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } -- 2.43.0 From 2985cba79ba56d21f4ec0a020467ba65c1b443b0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 309/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index e197d31..5eeb0bd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -896,4 +896,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From 5d71f3f2dbe14425e6a1c1a6f4c585e43243a059 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 310/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 11015c8..ede969e 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -112,6 +112,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From cc0ac317462aef432c0044557dfea1e3c9a6ae1b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 311/469] Added an API to update existing contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 1 file changed, 227 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5eeb0bd..ebd5e49 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -845,17 +845,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -892,8 +907,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From 5a9c08fd6c0a9372737c31fd79b69e3baaa01bcf Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 312/469] added api to get list of contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ede969e..ef8f7f0 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; -- 2.43.0 From 1f49057cb67bd713f96450f68ba3cdcfe031dbf5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 313/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ebd5e49..21c9b4b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1116,5 +1116,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From 0917b6665f878dea31511367b05523c231cd97b1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 314/469] Added an API to create a contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ef8f7f0..ede969e 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Mapper; -- 2.43.0 From 7016e38bc47c349bef54a1b7e28c926bc55dd439 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 315/469] Added an API to create bucket --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 21c9b4b..fa323d1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1138,5 +1138,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From 56e444f87f588be2d421ac50491df7e03486d6ad Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 316/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index fa323d1..9dbacff 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1060,7 +1060,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 4eeeec5dbe4c6596347ce541d4387089b71f5c3b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 317/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 - .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 388 --- 7 files changed, 3141 insertions(+), 390 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 3b38c0b..8a1668d 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 12951b9..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -29,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..b368b47 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -58,6 +58,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9dbacff..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -787,393 +787,5 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> CreateContact(CreateContactDto createContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (createContact != null) - { - List phones = new List(); - List emails = new List(); - List contactBucketMappings = new List(); - List contactTagMappings = new List(); - - Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); - - _context.Contacts.Add(contact); - await _context.SaveChangesAsync(); - _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); - - var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); - var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - if (createContact.ContactPhones != null) - { - - foreach (var contactPhone in createContact.ContactPhones) - { - ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); - phones.Add(phone); - } - _context.ContactsPhones.AddRange(phones); - _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.ContactEmails != null) - { - - foreach (var contactEmail in createContact.ContactEmails) - { - ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); - emails.Add(email); - } - _context.ContactsEmails.AddRange(emails); - _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.BucketIds != null) - { - foreach (var bucket in createContact.BucketIds) - { - if (buckets.Contains(bucket)) - { - ContactBucketMapping bucketMapping = new ContactBucketMapping - { - BucketId = bucket, - ContactId = contact.Id - }; - contactBucketMappings.Add(bucketMapping); - } - } - _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); - } - if (createContact.Tags != null) - { - foreach (var tag in createContact.Tags) - { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) - { - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) - { - var newtag = new ContactTagMaster - { - Name = tag.Name - }; - _context.ContactTagMasters.Add(newtag); - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagtId = newtag.Id, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - } - _context.ContactTagMappings.AddRange(contactTagMappings); - } - await _context.SaveChangesAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTagMappings) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - - return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContact != null) - { - if (updateContact.Id != id) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); - } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contact == null) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); - - List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var phoneIds = phones.Select(p => p.Id).ToList(); - List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var emailIds = emails.Select(p => p.Id).ToList(); - - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); - - List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - - if (updateContact.ContactPhones != null) - { - var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); - foreach (var phoneDto in updateContact.ContactPhones) - { - var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); - if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Update(phone); - } - else - { - _context.ContactsPhones.Add(phone); - } - } - foreach (var phone in phones) - { - - if (!updatedPhoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Remove(phone); - } - } - } - else if (phones != null) - { - _context.ContactsPhones.RemoveRange(phones); - } - - if (updateContact.ContactEmails != null) - { - var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); - - foreach (var emailDto in updateContact.ContactEmails) - { - var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); - if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) - { - _context.ContactsEmails.Update(email); - } - else - { - _context.ContactsEmails.Add(email); - } - } - foreach (var email in emails) - { - - if (!updateEmailIds.Contains(email.Id)) - { - _context.ContactsEmails.Remove(email); - } - } - } - else if (emails != null) - { - _context.ContactsEmails.RemoveRange(emails); - } - - if (updateContact.BucketIds != null) - { - foreach (var bucketId in updateContact.BucketIds) - { - if (!bucketIds.Contains(bucketId)) - { - _context.ContactBucketMappings.Add(new ContactBucketMapping - { - BucketId = bucketId, - ContactId = contact.Id - }); - } - } - foreach (var bucketMapping in contactBuckets) - { - if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) - { - _context.ContactBucketMappings.Remove(bucketMapping); - } - } - } - else if (contactBuckets != null) - { - _context.ContactBucketMappings.RemoveRange(contactBuckets); - } - - if (updateContact.Tags != null) - { - var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); - foreach (var tag in updateContact.Tags) - { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) - { - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagtId = tag.Id.Value - }); - } - else if (tag.Id == null || tag.Id == Guid.Empty) - { - ContactTagMaster contactTag = new ContactTagMaster - { - Name = tag.Name, - Description = "" - }; - _context.ContactTagMasters.Add(contactTag); - - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagtId = contactTag.Id - }); - } - } - foreach (var contactTag in contactTags) - { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) - { - _context.ContactTagMappings.Remove(contactTag); - } - } - } - else if (contactTags != null) - { - _context.ContactTagMappings.RemoveRange(contactTags); - } - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contact.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - - phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTags) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - - // -------------------------------- Bucket -------------------------------- - - public async Task> GetBucketList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - - List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); - - List bucketVMs = new List(); - foreach (var bucket in bucketList) - { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); - } - _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); - } - - public async Task> CreateBucket(CreateBucketDto bucketDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (bucketDto != null) - { - var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); - if (existingBucket != null) - { - _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); - } - Bucket bucket = new Bucket - { - Name = bucketDto.Name, - Description = bucketDto.Description, - TenantId = tenantId - }; - _context.Buckets.Add(bucket); - - EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping - { - EmployeeId = LoggedInEmployee.Id, - BucketId = bucket.Id - }; - - _context.EmployeeBucketMappings.Add(employeeBucket); - await _context.SaveChangesAsync(); - - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } } } -- 2.43.0 From f994ee14a2680044c99709a360ef38dc021d06b5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 318/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 77 +- 12 files changed, 20 insertions(+), 3285 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 8a1668d..3b38c0b 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 32fd7fe..9d70475 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -382,6 +382,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -537,32 +540,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2656,33 +2633,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..8197c94 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b368b47..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -58,24 +58,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..157c62d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,19 +31,14 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -61,10 +56,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -74,7 +68,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -84,7 +78,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -97,17 +91,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -234,8 +220,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -258,7 +242,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -274,29 +257,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -314,8 +276,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -326,20 +287,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -365,8 +318,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -545,8 +496,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -559,7 +509,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -582,10 +532,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -614,9 +560,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 282a21adc2a3fd3c28b126e3ef048184175de2a2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 319/469] Added an API to delete existing contact category --- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index ede969e..a26f401 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -127,6 +127,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 6f902178a44e82a2cfa5ff34605fe4d6bcaf6700 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 320/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 +++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 77 ++++++++++++++++--- 8 files changed, 145 insertions(+), 20 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 9d70475..32fd7fe 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -382,9 +382,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -540,6 +537,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2633,6 +2656,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 8197c94..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 157c62d..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -31,14 +31,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -56,9 +61,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -68,7 +74,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -78,7 +84,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -91,9 +97,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -220,6 +234,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -242,6 +258,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -257,8 +274,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -276,7 +314,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -287,12 +326,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -318,6 +365,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -496,7 +545,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -509,7 +559,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -532,6 +582,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -560,6 +614,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 1d6f8825c6818d37255ddc6207d5c4621afe6534 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 321/469] properly mapped the updated Dto to contact table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..cfbc4d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -576,7 +576,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 9a5be28196f5c401196f41240a7e4f895fdbb2e3 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 322/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index cfbc4d0..c856172 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -576,19 +576,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From a4aae7ebbe525ad9a2b6070f81c6a080d1400da5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 323/469] Added an API to get contact category by its size --- Marco.Pms.Services/Helpers/MasterHelper.cs | 49 ---------------------- 1 file changed, 49 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index a26f401..11015c8 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -112,55 +112,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } - public async Task> DeleteContactCategory(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contactCategory != null) - { - List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); - if (existingContacts.Count > 0) - { - List? contacts = new List(); - foreach (var contact in existingContacts) - { - contact.ContactCategoryId = null; - contacts.Add(contact); - } - _context.Contacts.UpdateRange(contacts); - } - _context.ContactCategoryMasters.Remove(contactCategory); - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); - } - // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 8209f06410e7861020614a1b772ca30ae81c4044 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 324/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c856172..0cad29c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -728,6 +728,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 872bcdd236ba7dbb647ed98022720a85ed28fabe Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 325/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 0cad29c..980fb68 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -765,6 +765,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 9fd01c7903fbcede0bd342a85b8c6cc5b87954cd Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 10:57:17 +0530 Subject: [PATCH 326/469] Corrected the typo of ContactTagtId to ContactTagId --- ...Added_Directory_Related_Tables.Designer.cs | 3 --- ...14103249_Added_Directory_Related_Tables.cs | 6 ++--- ...ed_ContactProjectMapping_Table.Designer.cs | 2 -- .../ApplicationDbContextModelSnapshot.cs | 3 --- .../Directory/ContactTagMapping.cs | 2 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 26 +++++++++---------- Marco.Pms.Services/Helpers/MasterHelper.cs | 2 +- 7 files changed, 17 insertions(+), 27 deletions(-) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs index f50346e..aad7361 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.Designer.cs @@ -493,9 +493,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - b.HasKey("Id"); b.HasIndex("ContactId"); diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs index 879f54b..7ef6da4 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable @@ -289,8 +288,7 @@ namespace Marco.Pms.DataAccess.Migrations { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactTagtId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactTagId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + ContactTagId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { diff --git a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs index 18a4be6..492cf00 100644 --- a/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs +++ b/Marco.Pms.DataAccess/Migrations/20250517063809_Added_ContactProjectMapping_Table.Designer.cs @@ -516,8 +516,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); b.HasKey("Id"); diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 32fd7fe..617afec 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -575,9 +575,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactTagId") .HasColumnType("char(36)"); - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - b.HasKey("Id"); b.HasIndex("ContactId"); diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs index a3d7e9e..91c2835 100644 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -5,7 +5,7 @@ public Guid Id { get; set; } public Guid ContactId { get; set; } public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } + public Guid ContactTagId { get; set; } public ContactTagMaster? ContactTag { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 980fb68..5920cbd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Services.Helpers var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + List TagIds = Tags.Select(t => t.ContactTagId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -89,7 +89,7 @@ namespace Marco.Pms.Services.Helpers foreach (var tagMapping in tagMappingss) { ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); conatctTagVms.Add(tagVM); @@ -147,7 +147,7 @@ namespace Marco.Pms.Services.Helpers List tagMasters = new List(); if (tags.Count > 0) { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagIds = tags.Select(ct => ct.ContactTagId).ToList(); tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); } @@ -188,7 +188,7 @@ namespace Marco.Pms.Services.Helpers { foreach (var contactTag in contactTags) { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagId); if (tagMaster != null) { ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); @@ -307,7 +307,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) @@ -320,7 +320,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = newtag.Id, + ContactTagId = newtag.Id, ContactId = contact.Id }; contactTagMappings.Add(tagMapping); @@ -336,7 +336,7 @@ namespace Marco.Pms.Services.Helpers List phoneVMs = new List(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + var tagIds = contactTagMappings.Select(t => t.ContactTagId).ToList(); tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); @@ -355,7 +355,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTagMappings) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } @@ -404,7 +404,7 @@ namespace Marco.Pms.Services.Helpers var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); @@ -537,7 +537,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -553,7 +553,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = contactTag.Id + ContactTagId = contactTag.Id }); } } @@ -584,7 +584,7 @@ namespace Marco.Pms.Services.Helpers contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); @@ -604,7 +604,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTags) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 11015c8..4d29908 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -161,7 +161,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster? contactTag = await _context.ContactTagMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contactTag != null) { - List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagtId == contactTag.Id).ToListAsync(); + List? tagMappings = await _context.ContactTagMappings.Where(t => t.ContactTagId == contactTag.Id).ToListAsync(); _context.ContactTagMasters.Remove(contactTag); if (tagMappings.Any()) -- 2.43.0 From d136e8b95eadfe46e1f09a12de07582c9b422c23 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 11:09:30 +0530 Subject: [PATCH 327/469] Addd migrations fro Typo --- ...53019_Fixed_Typo_Of_ColumnName.Designer.cs | 3007 +++++++++++++++++ ...20250519053019_Fixed_Typo_Of_ColumnName.cs | 64 + .../ApplicationDbContextModelSnapshot.cs | 6 +- 3 files changed, 3075 insertions(+), 2 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs diff --git a/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs new file mode 100644 index 0000000..39fe4c3 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.Designer.cs @@ -0,0 +1,3007 @@ +// +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("20250519053019_Fixed_Typo_Of_ColumnName")] + partial class Fixed_Typo_Of_ColumnName + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Grants a user the ability to record their own work hours or presence within the system. This typically involves checking in and checking out, logging break times, and potentially viewing their own attendance history.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage 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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs new file mode 100644 index 0000000..5b33d21 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250519053019_Fixed_Typo_Of_ColumnName.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Fixed_Typo_Of_ColumnName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings"); + + migrationBuilder.AlterColumn( + name: "ContactTagId", + table: "ContactTagMappings", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci", + oldClrType: typeof(Guid), + oldType: "char(36)", + oldNullable: true) + .OldAnnotation("Relational:Collation", "ascii_general_ci"); + + migrationBuilder.AddForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId", + principalTable: "ContactTagMasters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings"); + + migrationBuilder.AlterColumn( + name: "ContactTagId", + table: "ContactTagMappings", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci", + oldClrType: typeof(Guid), + oldType: "char(36)") + .OldAnnotation("Relational:Collation", "ascii_general_ci"); + + migrationBuilder.AddForeignKey( + name: "FK_ContactTagMappings_ContactTagMasters_ContactTagId", + table: "ContactTagMappings", + column: "ContactTagId", + principalTable: "ContactTagMasters", + principalColumn: "Id"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 617afec..c38b773 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -572,7 +572,7 @@ namespace Marco.Pms.DataAccess.Migrations b.Property("ContactId") .HasColumnType("char(36)"); - b.Property("ContactTagId") + b.Property("ContactTagId") .HasColumnType("char(36)"); b.HasKey("Id"); @@ -2690,7 +2690,9 @@ namespace Marco.Pms.DataAccess.Migrations b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") .WithMany() - .HasForeignKey("ContactTagId"); + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); b.Navigation("Contact"); -- 2.43.0 From ad659c4fc9ebd5a5d8e5d99b16ba84fdc90254b0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 13:18:32 +0530 Subject: [PATCH 328/469] Changed tag validation --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5920cbd..ee4751e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -411,7 +411,8 @@ namespace Marco.Pms.Services.Helpers var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); + List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -531,7 +532,10 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tagNames.Contains(tag.Name.ToLower())) + var namecheck = tagNames.Contains(tag.Name.ToLower()); + var idCheck = (!tagIds.Contains(tag.Id ?? Guid.Empty)); + var test = namecheck && idCheck; + if (test) { ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping @@ -559,7 +563,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 99222555142db0698884d8ccc0a96664af96b875 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 09:46:03 +0530 Subject: [PATCH 329/469] Created an API to get contact profile by its Id --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 18 ++- .../ViewModels/Directory/ContactNoteVM.cs | 8 +- .../ViewModels/Directory/ContactProfileVM.cs | 26 ++++ .../ViewModels/Projects/BasicProjectVM.cs | 8 ++ .../Controllers/DirectoryController.cs | 14 ++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 121 +++++++++++++++++- 6 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -51,6 +51,20 @@ namespace Marco.Pms.Model.Mapper Address = contact.Address ?? string.Empty }; } + public static ContactProfileVM ToContactProfileVMFromContact(this Contact contact) + { + return new ContactProfileVM + { + Id = contact.Id, + Name = contact.Name, + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty, + CreatedAt = contact.CreatedAt, + CreatedBy = contact.CreatedBy != null ? contact.CreatedBy.ToBasicEmployeeVMFromEmployee() : null + }; + } //Contact Phone Mapper public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) @@ -207,7 +221,9 @@ namespace Marco.Pms.Model.Mapper { Id = note.Id, Note = note.Note, - ContactId = note.ContactId + ContactId = note.ContactId, + CreatedAt = note.CreatedAt, + CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null }; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs index 5e1c340..c3ca209 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -1,9 +1,15 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class ContactNoteVM { public Guid Id { get; set; } public string Note { get; set; } = string.Empty; + public DateTime CreatedAt { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } + public DateTime? UpdatedAt { get; set; } + public BasicEmployeeVM? UpdatedBy { get; set; } public Guid ContactId { get; set; } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs new file mode 100644 index 0000000..8103c5c --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs @@ -0,0 +1,26 @@ +using Marco.Pms.Model.ViewModels.Activities; +using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Model.ViewModels.Projects; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactProfileVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public DateTime CreatedAt { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } + public DateTime? UpdatedAt { get; set; } + public BasicEmployeeVM? UpdatedBy { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } + public List? Projects { get; set; } + public List? Buckets { get; set; } + public List? Tags { get; set; } + public List? Notes { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs b/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs new file mode 100644 index 0000000..e08caa9 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Projects/BasicProjectVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Projects +{ + public class BasicProjectVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..12317d3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,20 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("profile/{id}")] + public async Task GetContactProfile(Guid id) + { + var response = await _directoryHelper.GetContactProfile(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ee4751e..c3f0ae0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2,9 +2,11 @@ using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Directory; using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Projects; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Directory; using Marco.Pms.Model.ViewModels.Master; +using Marco.Pms.Model.ViewModels.Projects; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.EntityFrameworkCore; @@ -213,7 +215,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -627,6 +628,121 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactProfile(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.Include(c => c.ContactCategory).Include(c => c.CreatedBy).FirstOrDefaultAsync(c => c.Id == id && c.IsActive); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + ContactProfileVM contactVM = contact.ToContactProfileVMFromContact(); + DirectoryUpdateLog? updateLog = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => l.RefereanceId == contact.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefaultAsync(); + if (updateLog != null) + { + contactVM.UpdatedAt = updateLog.UpdateAt; + contactVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + + List? phones = await _context.ContactsPhones.Where(p => p.ContactId == contact.Id).ToListAsync(); + if (phones.Any()) + { + List? phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + contactVM.ContactPhones = phoneVMs; + } + + List? emails = await _context.ContactsEmails.Where(e => e.ContactId == contact.Id).ToListAsync(); + if (emails.Any()) + { + List? emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + contactVM.ContactEmails = emailVMs; + } + + List? contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + if (contactProjects.Any()) + { + List projectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + List? projects = await _context.Projects.Where(p => projectIds.Contains(p.Id) && p.TenantId == tenantId).ToListAsync(); + List? projectVMs = new List(); + foreach (var project in projects) + { + BasicProjectVM projectVM = new BasicProjectVM + { + Id = project.Id, + Name = project.Name + }; + projectVMs.Add(projectVM); + } + contactVM.Projects = projectVMs; + } + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + if (contactBuckets.Any() && employeeBuckets.Any()) + { + List contactBucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + List employeeBucketIds = employeeBuckets.Select(eb => eb.BucketId).ToList(); + List? buckets = await _context.Buckets.Where(b => contactBucketIds.Contains(b.Id) && employeeBucketIds.Contains(b.Id)).ToListAsync(); + List? bucketVMs = new List(); + foreach (var bucket in buckets) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + contactVM.Buckets = bucketVMs; + } + List? contactTags = await _context.ContactTagMappings.Where(ct => ct.ContactId == contact.Id).ToListAsync(); + if (contactTags.Any()) + { + List tagIds = contactTags.Select(ct => ct.ContactTagId).ToList(); + List tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + List tagVMs = new List(); + foreach (var tagMaster in tagMasters) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + contactVM.Tags = tagVMs; + } + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + if (notes.Any()) + { + List? noteIds = notes.Select(n => n.Id).ToList(); + List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.Id)).OrderByDescending(l => l.UpdateAt).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + DirectoryUpdateLog? noteUpdateLog = noteUpdateLogs.Where(n => n.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + if (noteUpdateLog != null) + { + noteVM.UpdatedAt = noteUpdateLog.UpdateAt; + noteVM.UpdatedBy = noteUpdateLog.Employee != null ? noteUpdateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + noteVMs.Add(noteVM); + } + contactVM.Notes = noteVMs; + } + _logger.LogInfo("Employee ID {EmployeeId} fetched profile of contact {COntactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact profile fetched successfully"); + + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- @@ -695,7 +811,8 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - + noteVM.UpdatedAt = DateTime.UtcNow; + noteVM.UpdatedBy = LoggedInEmployee.ToBasicEmployeeVMFromEmployee(); _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); -- 2.43.0 From 3633d2ce4bb3f1c5e301adbbe5ae178d7da9e53c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 12:38:09 +0530 Subject: [PATCH 330/469] changed all list in contact profile view model to non-nullable and set default value to empty list --- .../ViewModels/Directory/ContactProfileVM.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs index 8103c5c..9e8f4cb 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactProfileVM.cs @@ -15,12 +15,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public BasicEmployeeVM? CreatedBy { get; set; } public DateTime? UpdatedAt { get; set; } public BasicEmployeeVM? UpdatedBy { get; set; } - public List? ContactPhones { get; set; } - public List? ContactEmails { get; set; } + public List ContactPhones { get; set; } = new List(); + public List ContactEmails { get; set; } = new List(); public ContactCategoryVM? ContactCategory { get; set; } - public List? Projects { get; set; } - public List? Buckets { get; set; } - public List? Tags { get; set; } - public List? Notes { get; set; } + public List Projects { get; set; } = new List(); + public List Buckets { get; set; } = new List(); + public List Tags { get; set; } = new List(); + public List Notes { get; set; } = new List(); } } -- 2.43.0 From b15022774ffbfeea03b2637342d22666665293f9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 10:28:17 +0530 Subject: [PATCH 331/469] Implemented an API to retrieve a list of organizations provided in the contacts. --- Marco.Pms.Services/Controllers/DirectoryController.cs | 7 +++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 12317d3..8f2cb5c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -113,6 +113,13 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("organization")] + public async Task GetOrganizationList() + { + var response = await _directoryHelper.GetOrganizationList(); + return Ok(response); + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c3f0ae0..da8514a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -743,6 +743,15 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); } + public async Task> GetOrganizationList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var organizationList = await _context.Contacts.Where(c => c.TenantId == tenantId).Select(c => c.Organization).Distinct().ToListAsync(); + _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); + return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From 8c915d7a1d323428aa20ec95e9404b7d2d7bc91a Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Tue, 20 May 2025 10:00:57 +0530 Subject: [PATCH 332/469] created api for contact Tag Update --- .../Controllers/MasterController.cs | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 61baaa3..36a3ee8 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,6 +1,8 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -638,8 +640,7 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - _logger.LogError("User sent empyt payload"); - return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); + } [HttpDelete("work-category/{id}")] @@ -774,7 +775,36 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag/edit/{id}")] public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) { - return Ok(); + + var tenantId = _userHelper.GetTenantId(); + Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContactTagDto != null && updateContactTagDto.Id != id) + { + ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); + if(contactTag != null) + { + contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); + _context.ContactTagMasters.Update(contactTag); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactTag.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + + ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); + + + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); + return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); + } + } + _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); + return NotFound(ApiResponse.ErrorResponse("Contact Tag master not found", "Work category master not found", 404)); + } [HttpDelete("contact-tag/{id}")] -- 2.43.0 From d1995b820c9d969c745bf4ba3b2a06d515fbd803 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 17:29:20 +0530 Subject: [PATCH 333/469] Implemented an API to suspend a Contact --- .../Controllers/DirectoryController.cs | 22 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 8f2cb5c..843aacb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -107,6 +107,10 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 404) + { + return NotFound(response); + } else { return BadRequest(response); @@ -120,6 +124,24 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } + [HttpDelete("{id}")] + public async Task DeleteContact(Guid id) + { + var response = await _directoryHelper.DeleteContact(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index da8514a..68562ac 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -752,6 +752,26 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } + public async Task> DeleteContact(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + contact.IsActive = false; + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From 2456a9a039f74bb3cbaf7260e800b22a2cfb7c39 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 13:05:08 +0000 Subject: [PATCH 334/469] Update Marco.Pms.Services/Helpers/DirectoryHelper.cs Added entrie to DirectoryUpdateLog Table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 68562ac..aacd71a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -765,6 +765,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } contact.IsActive = false; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); -- 2.43.0 From 707b948e157dab7ff78d55979807b8763cd2ded0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 17:26:51 +0530 Subject: [PATCH 335/469] Implemented filtering functionality for Get Contact List API --- .../Dtos/Directory/ContactFilterDto.cs | 9 ++++ .../Controllers/DirectoryController.cs | 4 +- .../Controllers/MasterController.cs | 9 ++-- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 41 +++++++++++++++++-- 4 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs b/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs new file mode 100644 index 0000000..3f06388 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/ContactFilterDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class ContactFilterDto + { + public List? BucketIds { get; set; } + public List? CategoryIds { get; set; } + + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 843aacb..2e6db54 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList() + public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(); + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); if (response.StatusCode == 200) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 36a3ee8..dc4cd61 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -640,7 +640,8 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - + _logger.LogError("User sent empyt payload"); + return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); } [HttpDelete("work-category/{id}")] @@ -781,7 +782,7 @@ namespace Marco.Pms.Services.Controllers if (updateContactTagDto != null && updateContactTagDto.Id != id) { ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); - if(contactTag != null) + if (contactTag != null) { contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); _context.ContactTagMasters.Update(contactTag); @@ -796,8 +797,8 @@ namespace Marco.Pms.Services.Controllers ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); - - + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index aacd71a..cebba78 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -29,17 +29,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts() + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - + if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) + { + bucketIds = filterDto.BucketIds; + } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + List contacts = new List(); + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) + { + var categoryIds = filterDto.CategoryIds; + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && categoryIds.Contains(c.ContactCategoryId ?? Guid.Empty) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } + else + { + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); @@ -50,6 +62,19 @@ namespace Marco.Pms.Services.Helpers var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + if (search != null && search != string.Empty) + { + List filteredContactIds = new List(); + phoneNo = phoneNo.Where(p => Compare(p.PhoneNumber, search)).ToList(); + filteredContactIds = phoneNo.Select(p => p.ContactId).ToList(); + + Emails = Emails.Where(e => Compare(e.EmailAddress, search)).ToList(); + filteredContactIds.AddRange(Emails.Select(e => e.ContactId).ToList()); + filteredContactIds = filteredContactIds.Distinct().ToList(); + + contacts = contacts.Where(c => Compare(c.Name, search) || Compare(c.Organization, search) || filteredContactIds.Contains(c.Id)).ToList(); + } + List list = new List(); foreach (var contact in contacts) @@ -66,6 +91,7 @@ namespace Marco.Pms.Services.Helpers var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); + if (emails != null && emails.Count > 0) { foreach (var email in emails) @@ -1005,5 +1031,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + private bool Compare(string sentence, string search) + { + sentence = sentence.Trim().ToLower(); + search = search.Trim().ToLower(); + + // Check for exact substring + bool result = sentence.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; + return result; + } } } -- 2.43.0 From 6dbd968676205946510bbc84583d2f4bb3982a95 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 22:10:51 +0530 Subject: [PATCH 336/469] Accepting List of buckets and categories Ids rather than as payload --- .../Controllers/DirectoryController.cs | 13 ++++++++---- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 2e6db54..ba05625 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,14 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) + public async Task GetContactList([FromQuery] string? search, [FromQuery] List? bucketIds, [FromQuery] List? categoryIds, [FromQuery] Guid? projectId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); + ContactFilterDto filterDto = new ContactFilterDto + { + BucketIds = bucketIds, + CategoryIds = categoryIds + }; + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto, projectId); if (response.StatusCode == 200) @@ -164,9 +169,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet("note/{ContactId}")] - public async Task GetNoteListByContactId(Guid contactId) + public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetNoteListByContactId(contactId); + var response = await _directoryHelper.GetNoteListByContactId(contactId, active); if (response.StatusCode == 200) { return Ok(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index cebba78..36c6884 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -29,20 +29,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto, Guid? projectId) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { - bucketIds = filterDto.BucketIds; + filterbucketIds = filterDto.BucketIds; } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + List contactIds = contactBuckets.Where(b => filterbucketIds.Contains(b.BucketId)).Select(cb => cb.ContactId).ToList(); List contacts = new List(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + if (projectId != null && projectId != Guid.Empty) + { + contactProjects = contactProjects.Where(p => p.ProjectId == projectId).ToList(); + contactIds = contactProjects.Select(p => p.ContactId).Distinct().ToList(); + } + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) { var categoryIds = filterDto.CategoryIds; @@ -56,7 +65,6 @@ namespace Marco.Pms.Services.Helpers var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); List TagIds = Tags.Select(t => t.ContactTagId).ToList(); @@ -809,14 +817,14 @@ namespace Marco.Pms.Services.Helpers // -------------------------------- Contact Notes -------------------------------- - public async Task> GetNoteListByContactId(Guid id) + public async Task> GetNoteListByContactId(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { -- 2.43.0 From 38463ccf078ed83fe076c08a374851515c8162ca Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 19:48:45 +0530 Subject: [PATCH 337/469] Implemented an API to update Buckets for grouping contacts. --- .../Dtos/Directory/UpdateBucketDto.cs | 9 ++++++ .../Controllers/DirectoryController.cs | 18 +++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 31 ++++++++++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs new file mode 100644 index 0000000..4428941 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateBucketDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateBucketDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index ba05625..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -247,5 +247,23 @@ namespace Marco.Pms.Services.Controllers } } + + [HttpPut("bucket/{id}")] + public async Task UpdateBucket(Guid id, [FromBody] UpdateBucketDto bucketDto) + { + var response = await _directoryHelper.UpdateBucket(id, bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 36c6884..8cf2b1e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1001,7 +1001,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } - public async Task> CreateBucket(CreateBucketDto bucketDto) { Guid tenantId = _userHelper.GetTenantId(); @@ -1038,7 +1037,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateBucket(Guid id, UpdateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null && id == bucketDto.Id) + { + var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + bucket.Name = bucketDto.Name ?? ""; + bucket.Description = bucketDto.Description ?? ""; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketDto.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 2a0adc75c4268cd833fa809d7803f9d2c469058c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 20:27:13 +0530 Subject: [PATCH 338/469] Implemented an API to update Contact Category Master --- .../Controllers/MasterController.cs | 55 +++++++--------- Marco.Pms.Services/Helpers/MasterHelper.cs | 65 +++++++++++++++++++ 2 files changed, 89 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index dc4cd61..3512081 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,8 +1,6 @@ using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -717,11 +715,22 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } - [HttpPost("contact-category/edit/{id}")] public async Task UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto) { - return Ok(); + var response = await _masterHelper.UpdateContactCategory(id, updateContactCategoryDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("contact-category/{id}")] @@ -776,36 +785,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("contact-tag/edit/{id}")] public async Task UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto) { - - var tenantId = _userHelper.GetTenantId(); - Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContactTagDto != null && updateContactTagDto.Id != id) + var response = await _masterHelper.UpdateContactTag(id, updateContactTagDto); + if (response.StatusCode == 200) { - ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == updateContactTagDto.Id); - if (contactTag != null) - { - contactTag = updateContactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); - _context.ContactTagMasters.Update(contactTag); - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contactTag.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - - ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); - - - - _logger.LogInfo("Work category master {ConatctTagId} updated successfully from tenant {tenantId}", contactTagVm.Id, tenantId); - return Ok(ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200)); - } + return Ok(response); } - _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); - return NotFound(ApiResponse.ErrorResponse("Contact Tag master not found", "Work category master not found", 404)); + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("contact-tag/{id}")] diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 4d29908..55883f6 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,6 +1,7 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Utilities; using Marco.Pms.Model.ViewModels.Master; @@ -47,6 +48,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContactCategory(Guid id, UpdateContactCategoryDto contactCategoryDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactCategoryDto != null && id == contactCategoryDto.Id) + { + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Id == id); + if (contactCategory != null) + { + contactCategory.Name = contactCategoryDto.Name ?? ""; + contactCategory.Description = contactCategoryDto.Description ?? ""; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactCategory.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster(); + + _logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id); + return ApiResponse.SuccessResponse(categoryVM, "Category Created Successfully", 200); + } + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a contact category but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Category not found", "Category not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> GetContactCategoriesList() { Guid tenantId = _userHelper.GetTenantId(); @@ -154,6 +186,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContactTag(Guid id, UpdateContactTagDto contactTagDto) + { + var tenantId = _userHelper.GetTenantId(); + Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (contactTagDto != null && contactTagDto.Id != id) + { + ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == contactTagDto.Id); + if (contactTag != null) + { + contactTag = contactTagDto.ToContactTagMasterFromUpdateContactTagDto(tenantId); + _context.ContactTagMasters.Update(contactTag); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contactTag.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + + ContactTagVM contactTagVm = contactTag.ToContactTagVMFromContactTagMaster(); + + + + _logger.LogInfo("Work category master {ConatctTagId} updated successfully by employee {EmployeeId}", contactTagVm.Id, LoggedInEmployee.Id); + ApiResponse.SuccessResponse(contactTagVm, "Contact Tag master updated successfully", 200); + } + _logger.LogError("Contact Tag master {ContactTagId} not found in database", id); + ApiResponse.ErrorResponse("Contact Tag master not found", "Contact tag master not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> DeleteContactTag(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 10322fa4323a0962326b97325bb602ea00450345 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 24 May 2025 15:45:43 +0530 Subject: [PATCH 339/469] Add Directory Management Feature with Permission Handling --- .../Data/ApplicationDbContext.cs | 17 +- ...d_Feature_Directory_Management.Designer.cs | 3055 +++++++++++++++++ ...4333_Added_Feature_Directory_Management.cs | 100 + .../ApplicationDbContextModelSnapshot.cs | 48 + Marco.Pms.Model/Directory/Bucket.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 + 6 files changed, 3219 insertions(+), 9 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 3b38c0b..1cedb09 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -480,17 +480,15 @@ namespace Marco.Pms.DataAccess.Data modelBuilder.Entity().HasData( new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Manage Project", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, new Feature { Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), Description = "Manage Infra", Name = "Manage Infra", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, - new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Task Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), 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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, - - new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Employee Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true }, new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true }, - new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } - //new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } + new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }, + new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Managing all directory related rights", Name = "Directory Management", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } + + //new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true } ); modelBuilder.Entity().HasData( @@ -518,8 +516,11 @@ namespace Marco.Pms.DataAccess.Data new FeaturePermission { Id = new Guid("ccb0589f-712b-43de-92ed-5b6088e7dc4e"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Self Attendance", Description = "Team Attendance refers to tracking and managing the attendance of all team members collectively, often monitored by a team lead or manager." }, new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency" }, - new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" } - //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("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" }, + + new FeaturePermission { Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Admin", Description = "Full control over all directories, including the ability to manage permissions for all directories in the system." }, + new FeaturePermission { Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Manager", Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories." }, + new FeaturePermission { Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory User", Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created." } //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/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs new file mode 100644 index 0000000..6e2f931 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs @@ -0,0 +1,3055 @@ +// +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("20250524074333_Added_Feature_Directory_Management")] + partial class Added_Feature_Directory_Management + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedByID"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Grants a user the ability to record their own work hours or presence within the system. This typically involves checking in and checking out, logging break times, and potentially viewing their own attendance history.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" + }); + }); + + 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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs new file mode 100644 index 0000000..1319786 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.cs @@ -0,0 +1,100 @@ +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 Added_Feature_Directory_Management : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CreatedAt", + table: "Buckets", + type: "datetime(6)", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "CreatedByID", + table: "Buckets", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.InsertData( + table: "Features", + columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" }, + values: new object[] { new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Managing all directory related rights", true, new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), "Directory Management" }); + + migrationBuilder.InsertData( + table: "FeaturePermissions", + columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" }, + values: new object[,] + { + { new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory User" }, + { new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), "Full control over all directories, including the ability to manage permissions for all directories in the system.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Admin" }, + { new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Manager" } + }); + + migrationBuilder.CreateIndex( + name: "IX_Buckets_CreatedByID", + table: "Buckets", + column: "CreatedByID"); + + migrationBuilder.AddForeignKey( + name: "FK_Buckets_Employees_CreatedByID", + table: "Buckets", + column: "CreatedByID", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Buckets_Employees_CreatedByID", + table: "Buckets"); + + migrationBuilder.DropIndex( + name: "IX_Buckets_CreatedByID", + table: "Buckets"); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("0f919170-92d4-4337-abd3-49b66fc871bb")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("62668630-13ce-4f52-a0f0-db38af2230c5")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606")); + + migrationBuilder.DropColumn( + name: "CreatedAt", + table: "Buckets"); + + migrationBuilder.DropColumn( + name: "CreatedByID", + table: "Buckets"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index c38b773..2f999d2 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -331,6 +331,12 @@ namespace Marco.Pms.DataAccess.Migrations .ValueGeneratedOnAdd() .HasColumnType("char(36)"); + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + b.Property("Description") .IsRequired() .HasColumnType("longtext"); @@ -344,6 +350,8 @@ namespace Marco.Pms.DataAccess.Migrations b.HasKey("Id"); + b.HasIndex("CreatedByID"); + b.HasIndex("TenantId"); b.ToTable("Buckets"); @@ -1031,6 +1039,30 @@ namespace Marco.Pms.DataAccess.Migrations FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" }); }); @@ -1466,6 +1498,14 @@ namespace Marco.Pms.DataAccess.Migrations IsActive = true, ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" }); }); @@ -2540,12 +2580,20 @@ namespace Marco.Pms.DataAccess.Migrations modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("CreatedBy"); + b.Navigation("Tenant"); }); diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs index 028b428..0d382c5 100644 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -1,4 +1,5 @@ -using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; namespace Marco.Pms.Model.Directory { @@ -6,6 +7,9 @@ namespace Marco.Pms.Model.Directory { public Guid Id { get; set; } public string Name { get; set; } = string.Empty; + public Guid CreatedByID { get; set; } + public Employee? CreatedBy { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8cf2b1e..c11f9a8 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1017,6 +1017,8 @@ namespace Marco.Pms.Services.Helpers { Name = bucketDto.Name, Description = bucketDto.Description, + CreatedAt = DateTime.UtcNow, + CreatedByID = LoggedInEmployee.Id, TenantId = tenantId }; _context.Buckets.Add(bucket); -- 2.43.0 From c51da8d1b4bec58a3b1147797fdae72352512dec Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 340/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 654890a..012c7f8 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -6,4 +6,3 @@ public string? EmailAddress { get; set; } } } - -- 2.43.0 From d3a800fbf9dc632746ca2e329d219846e256efa2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 16:10:07 +0530 Subject: [PATCH 341/469] Added Migration for contact related tables --- .../20250514103249_Added_Directory_Related_Tables.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs index 7ef6da4..3dc4b68 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -- 2.43.0 From 9e124d0ae50544ac8509de0793d215c28669045a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 342/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 1 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 58 ------------------- .../appsettings.Development.json | 2 + 3 files changed, 3 insertions(+), 58 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 012c7f8..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -6,3 +6,4 @@ public string? EmailAddress { get; set; } } } + diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c11f9a8..a7e473a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -920,65 +920,7 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } // -------------------------------- Bucket -------------------------------- diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json index 9823b1b..3c9186c 100644 --- a/Marco.Pms.Services/appsettings.Development.json +++ b/Marco.Pms.Services/appsettings.Development.json @@ -10,6 +10,8 @@ }, "ConnectionStrings": { "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS10" + //"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2" + "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSDev" }, "SmtpSettings": { "SmtpServer": "smtp.gmail.com", -- 2.43.0 From 81f91c3b6d62413b51af9253b133673d46e5de2f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 343/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 55883f6..df9cee1 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,6 +144,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From eb3bd425f634cdf2687b8f01120b950dc15bb58c Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 344/469] added api to get list of contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index df9cee1..8cabe24 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,21 +144,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 578b2e0d6786cc80e64821559c2ba772bb20ba75 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 345/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 + 6 files changed, 3145 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 1cedb09..c7918dc 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..d9f9a66 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,6 +63,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a7e473a..f21a5d0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -62,6 +62,7 @@ namespace Marco.Pms.Services.Helpers contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); } + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); @@ -442,6 +443,9 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); -- 2.43.0 From 115e38b58f7d5684949b098435a66ad63edc2eac Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 346/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 57 +- 12 files changed, 17 insertions(+), 3268 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index c7918dc..1cedb09 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 2f999d2..0430289 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,6 +390,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -545,32 +548,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2701,33 +2678,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..358bf54 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d9f9a66..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,24 +63,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f21a5d0..298064d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -97,8 +97,6 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); if (emails != null && emails.Count > 0) @@ -111,7 +109,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -121,7 +119,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -134,17 +132,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -270,8 +260,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -294,7 +282,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -310,29 +297,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -350,8 +316,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -362,9 +327,7 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); @@ -401,8 +364,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -588,8 +549,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -657,9 +617,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 7a2ce067abacd2a065b94435a9c29d15dcbdf816 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 347/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 ++++++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 60 ++++++++++++++++--- 8 files changed, 131 insertions(+), 17 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 0430289..2f999d2 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,9 +390,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -548,6 +545,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2678,6 +2701,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 358bf54..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 298064d..4a7ad9e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -97,6 +97,8 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); if (emails != null && emails.Count > 0) @@ -109,7 +111,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -119,7 +121,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -132,9 +134,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -260,6 +270,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -282,6 +294,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -297,8 +310,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -316,7 +350,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -327,7 +362,9 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); @@ -364,6 +401,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -410,6 +449,9 @@ namespace Marco.Pms.Services.Helpers List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); @@ -549,7 +591,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -617,6 +660,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 0fb3690133d847ba2b26e662500a84f8e6ebcbf2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 348/469] properly mapped the updated Dto to contact table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4a7ad9e..5f06203 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -622,7 +622,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From ff13507f8fe27c0379ff676bbe33842a98d4c1be Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 349/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5f06203..4a7ad9e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -622,19 +622,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From ed9a2467e95bfc18f871542c9aae5d5da5f956a2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:13:35 +0530 Subject: [PATCH 350/469] added an API to get a list of contact-notes by contact ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4a7ad9e..bca931c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -443,12 +443,6 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); -- 2.43.0 From 220b87d5c32e4683b3c2a82031639312f9ca37d2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 351/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index bca931c..80fd413 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -923,6 +923,44 @@ namespace Marco.Pms.Services.Helpers + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 7dca88153f83a531096bd47651128c3d1fbe5f1d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 352/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 80fd413..d7cc3b1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -960,6 +960,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From eea2b7a8b3b492b3c6915d33ee44a5ee6811a359 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 353/469] created GetListOfContact custome function --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d7cc3b1..c4c1bd3 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -923,65 +923,6 @@ namespace Marco.Pms.Services.Helpers - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 80da3199b9056163a41c55cf886ccc5ad2f04920 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 354/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 8cabe24..9161d35 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -145,6 +145,22 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From e175e584504c9037940bd4db3e1687fe8d882aae Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 355/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Services/Helpers/MasterHelper.cs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 9161d35..55883f6 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,23 +144,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } - // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 0795eda5cc49f960a8022fc5330967a6cfe62b50 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 356/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 + 6 files changed, 3145 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 1cedb09..c7918dc 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..d9f9a66 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,6 +63,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c4c1bd3..179276b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -63,6 +63,7 @@ namespace Marco.Pms.Services.Helpers } + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); @@ -443,6 +444,9 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); -- 2.43.0 From 5e184c770d13678598f3f7e31ec2f5c18c95cd41 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 357/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 6 +- 12 files changed, 13 insertions(+), 3221 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index c7918dc..1cedb09 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 2f999d2..0430289 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,6 +390,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -545,32 +548,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2701,33 +2678,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..358bf54 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d9f9a66..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,24 +63,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 179276b..ecedf48 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -112,7 +112,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -122,7 +122,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -311,7 +311,7 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } if (createContact.ProjectIds != null) -- 2.43.0 From 3841dca11e0612beed06de4adcea4efa9dfbf06e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 358/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 ++++++++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 ++- 8 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 0430289..2f999d2 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,9 +390,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -548,6 +545,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2678,6 +2701,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 358bf54..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ecedf48..ada9b06 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -112,7 +112,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -122,7 +122,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -311,7 +311,7 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } if (createContact.ProjectIds != null) @@ -450,6 +450,9 @@ namespace Marco.Pms.Services.Helpers List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); -- 2.43.0 From 7d704b138bd71048a0629d4003cc02de5f0c1171 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 359/469] properly mapped the updated Dto to contact table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ada9b06..127aad5 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -623,7 +623,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 5fde9c5e53a9a0def3fccfbf1c7c3bc54852caf5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 360/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 127aad5..b787cd6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -156,6 +156,7 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } + public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -410,6 +411,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -444,12 +446,6 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); -- 2.43.0 From 605fd9c78df3e33e3212258afd4945653db385c4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 361/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b787cd6..f2f5b47 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -939,6 +939,44 @@ namespace Marco.Pms.Services.Helpers + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 6a1fa9a4f84382e5614394ffa6acec51696c9f65 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 362/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f2f5b47..57300b6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -976,6 +976,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From bad2386fa4f305776038224254914b416631d440 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 09:46:03 +0530 Subject: [PATCH 363/469] Created an API to get contact profile by its Id --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 57300b6..86d9449 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -939,65 +939,6 @@ namespace Marco.Pms.Services.Helpers - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 3128372a78fbd244a9e66c69f2151c0a8a323ac4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 24 May 2025 15:45:43 +0530 Subject: [PATCH 364/469] Add Directory Management Feature with Permission Handling --- Marco.Pms.Services/appsettings.Development.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json index 3c9186c..2cbcbcf 100644 --- a/Marco.Pms.Services/appsettings.Development.json +++ b/Marco.Pms.Services/appsettings.Development.json @@ -9,9 +9,7 @@ "Title": "Dev" }, "ConnectionStrings": { - "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS10" - //"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2" - "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSDev" + "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMSGuid" }, "SmtpSettings": { "SmtpServer": "smtp.gmail.com", -- 2.43.0 From 54ea82b984b3c72566f79ca962ae1afad34933e1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:24:41 +0530 Subject: [PATCH 365/469] Enhancement #375: Update "Get Contact" API to Enforce Feature Permissions --- .../Controllers/DirectoryController.cs | 5 ++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 29 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..de262fb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -39,12 +39,17 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); } } + [HttpGet("contact-bucket/{bucketId}")] public async Task GetContactsListByBucketId(Guid bucketId) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 86d9449..1beb114 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -18,13 +18,18 @@ namespace Marco.Pms.Services.Helpers private readonly ApplicationDbContext _context; private readonly ILoggingService _logger; private readonly UserHelper _userHelper; - + private readonly Guid directoryAdmin; + private readonly Guid directoryManager; + private readonly Guid directoryUser; public DirectoryHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) { _context = context; _logger = logger; _userHelper = userHelper; + directoryAdmin = Guid.Parse("4286a13b-bb40-4879-8c6d-18e9e393beda"); + directoryManager = Guid.Parse("62668630-13ce-4f52-a0f0-db38af2230c5"); + directoryUser = Guid.Parse("0f919170-92d4-4337-abd3-49b66fc871bb"); } @@ -33,9 +38,29 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + if (permissionIds.Contains(directoryAdmin)) + { + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketIds = buckets.Select(b => b.Id).ToList(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + var createdBucketIds = buckets.Select(b => b.Id).ToList(); + bucketIds.AddRange(createdBucketIds); + bucketIds = bucketIds.Distinct().ToList(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a contacts, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + + List filterbucketIds = bucketIds; if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { filterbucketIds = filterDto.BucketIds; -- 2.43.0 From fb2648ba1789ab297745284464b45ed486b0a342 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:27:04 +0530 Subject: [PATCH 366/469] Enhancement #376: Update "Get Contact by Bucket ID" API to Enforce Feature Permissions --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 1beb114..f3421b1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -188,12 +188,37 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (id != Guid.Empty) { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} attempted access to bucket ID {BucketId}, but not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(em => em.BucketId == id).ToListAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + + EmployeeBucketMapping? employeeBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + employeeBucket = employeeBuckets.FirstOrDefault(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + employeeBucket = employeeBuckets.FirstOrDefault(eb => eb.EmployeeId == LoggedInEmployee.Id); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a contacts with in bucket {BucketId}, but do not have permission", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + if (employeeBucket == null) { _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); List contactVMs = new List(); if (contactBucket.Count > 0) -- 2.43.0 From 4650e0cbbb88c47336788601930fd71004343f8c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:28:22 +0530 Subject: [PATCH 367/469] Enhancement #377: Update "Update Contact" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 4 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index de262fb..6b54891 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -103,6 +103,10 @@ namespace Marco.Pms.Services.Controllers { return NotFound(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f3421b1..8dd25fd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -480,6 +480,33 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + if (permissionIds.Contains(directoryAdmin)) + { + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketIds = buckets.Select(b => b.Id).ToList(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + var createdBucketIds = buckets.Select(b => b.Id).ToList(); + bucketIds.AddRange(createdBucketIds); + bucketIds = bucketIds.Distinct().ToList(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to update a contact, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id && bucketIds.Contains(m.BucketId)).ToListAsync(); + bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); await _context.SaveChangesAsync(); @@ -489,8 +516,7 @@ namespace Marco.Pms.Services.Helpers List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var emailIds = emails.Select(p => p.Id).ToList(); - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); -- 2.43.0 From f621dbf27cee7c6d0bbed9bee591b240ab566ec2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:32:51 +0530 Subject: [PATCH 368/469] Enhancement #378: Update "Get Bucket List" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 13 ++++++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 28 +++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 6b54891..d25c7e8 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -226,7 +226,18 @@ namespace Marco.Pms.Services.Controllers public async Task GetBucketList() { var response = await _directoryHelper.GetBucketList(); - return Ok(response); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } } [HttpPost("bucket")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8dd25fd..d319a1b 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1022,20 +1022,38 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + List bucketList = new List(); + if (permissionIds.Contains(directoryAdmin)) + { + bucketList = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a buckets list, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } List bucketVMs = new List(); - foreach (var bucket in bucketList) + if (bucketList.Any()) { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } } _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); } public async Task> CreateBucket(CreateBucketDto bucketDto) { -- 2.43.0 From f7d90b85e8f3f7345d17720a080fb4da8de17cc5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:35:09 +0530 Subject: [PATCH 369/469] Enhancement #380: Update "Create Bucket" API to Enforce Feature --- Marco.Pms.Services/Controllers/DirectoryController.cs | 4 ++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d25c7e8..680a708 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -261,6 +261,10 @@ namespace Marco.Pms.Services.Controllers { return Conflict(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d319a1b..66af082 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1061,6 +1061,15 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (bucketDto != null) { + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var demo = !permissionIds.Contains(directoryUser); + if (!permissionIds.Contains(directoryAdmin) && !permissionIds.Contains(directoryManager) && !permissionIds.Contains(directoryUser)) + { + _logger.LogError("Employee {EmployeeId} attemped to create a bucket, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); if (existingBucket != null) { -- 2.43.0 From c1cc8d5d3406a3582f292c108845e8b20ee76d13 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:37:24 +0530 Subject: [PATCH 370/469] Enhancement #381: Update "Update Bucket" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 4 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 29 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 680a708..cfc9ed8 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -284,6 +284,10 @@ namespace Marco.Pms.Services.Controllers { return NotFound(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 66af082..57fed5d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1108,12 +1108,39 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (bucketDto != null && id == bucketDto.Id) { - var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var bucketIds = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToListAsync(); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) { _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); } + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + bucket.Name = bucketDto.Name ?? ""; bucket.Description = bucketDto.Description ?? ""; -- 2.43.0 From 049189024a0d5267034177123239d932019a66b0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 16:29:42 +0530 Subject: [PATCH 371/469] Implement API to Assign Bucket to Employees --- .../Dtos/Directory/AssignBucketDto.cs | 8 ++ Marco.Pms.Model/Mapper/DirectoryMapper.cs | 9 ++ .../ViewModels/Directory/AssignBucketVM.cs | 10 ++ .../Controllers/DirectoryController.cs | 24 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 116 +++++++++++++++++- 5 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs diff --git a/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs new file mode 100644 index 0000000..f675cf3 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/AssignBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class AssignBucketDto + { + public Guid EmployeeId { get; set; } + public bool IsActive { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..2aea3c0 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -202,6 +202,15 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) + { + return new AssignBucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } //Contact Note public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs new file mode 100644 index 0000000..f4c8e2b --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class AssignBucketVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public List? EmployeeIds { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index cfc9ed8..192143d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -177,7 +177,7 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("note/{ContactId}")] + [HttpGet("notes/{ContactId}")] public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { var response = await _directoryHelper.GetNoteListByContactId(contactId, active); @@ -293,5 +293,27 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } + + [HttpPost("assign-bucket/{bucketId}")] + public async Task AssignBucket(Guid bucketId, [FromBody] List assignBuckets) + { + var response = await _directoryHelper.AssignBucket(bucketId, assignBuckets); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 57fed5d..35a11d7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1043,15 +1043,21 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); } - List bucketVMs = new List(); + List bucketVMs = new List(); if (bucketList.Any()) { foreach (var bucket in bucketList) { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + bucketVM.EmployeeIds = emplyeeIds; + bucketVMs.Add(bucketVM); } } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); } @@ -1110,7 +1116,8 @@ namespace Marco.Pms.Services.Helpers { var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - var bucketIds = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToListAsync(); + var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); if (bucket == null) @@ -1153,13 +1160,114 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + bucketVM.EmployeeIds = employeeIds; + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); } _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> AssignBucket(Guid bucketId, List assignBuckets) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (assignBuckets != null && bucketId != Guid.Empty) + { + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); + + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(bucketId)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + var employeeIds = await _context.Employees.Where(e => e.TenantId == tenantId && e.IsActive).Select(e => e.Id).ToListAsync(); + int assignedEmployee = 0; + int removededEmployee = 0; + foreach (var assignBucket in assignBuckets) + { + if (employeeIds.Contains(assignBucket.EmployeeId)) + { + if (assignBucket.IsActive) + { + EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping + { + EmployeeId = assignBucket.EmployeeId, + BucketId = bucketId + }; + _context.EmployeeBucketMappings.Add(employeeBucketMapping); + assignedEmployee += 1; + } + else + { + EmployeeBucketMapping? employeeBucketMapping = employeeBuckets.FirstOrDefault(eb => eb.BucketId == bucketId && eb.EmployeeId == assignBucket.EmployeeId); + if (employeeBucketMapping != null) + { + _context.EmployeeBucketMappings.Remove(employeeBucketMapping); + removededEmployee += 1; + } + } + } + } + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketId, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); + employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + bucketVM.EmployeeIds = employeeIds; + + + if (assignedEmployee > 0) + { + _logger.LogInfo("Employee {EmployeeId} assigned bucket {BucketId} to {conut} number of employees", LoggedInEmployee.Id, bucketId, assignedEmployee); + } + if (removededEmployee > 0) + { + _logger.LogError("Employee {EmployeeId} removed {conut} number of employees from bucket {BucketId}", LoggedInEmployee.Id, removededEmployee, bucketId); + } + return ApiResponse.SuccessResponse(bucketVM, "Details updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From a755e77397e3b1a7ff109504cc1fbd8447d957b8 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 10:40:00 +0530 Subject: [PATCH 372/469] Implemented an API to delete a Bucket --- .../Controllers/AttendanceController.cs | 4 +- .../Controllers/DirectoryController.cs | 30 ++++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 78 +++++++++++++++++-- 3 files changed, 101 insertions(+), 11 deletions(-) diff --git a/Marco.Pms.Services/Controllers/AttendanceController.cs b/Marco.Pms.Services/Controllers/AttendanceController.cs index 0c81f6e..5c7104d 100644 --- a/Marco.Pms.Services/Controllers/AttendanceController.cs +++ b/Marco.Pms.Services/Controllers/AttendanceController.cs @@ -150,12 +150,12 @@ namespace MarcoBMS.Services.Controllers if (dateFrom != null && DateTime.TryParse(dateFrom, out fromDate) == false) { - _logger.LogError("User sent Invalid from Date while featching attendance logs"); + _logger.LogError("User sent Invalid fromDate while featching attendance logs"); return BadRequest(ApiResponse.ErrorResponse("Invalid Date", "Invalid Date", 400)); } if (dateTo != null && DateTime.TryParse(dateTo, out toDate) == false) { - _logger.LogError("User sent Invalid to Date while featching attendance logs"); + _logger.LogError("User sent Invalid toDate while featching attendance logs"); return BadRequest(ApiResponse.ErrorResponse("Invalid Date", "Invalid Date", 400)); } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 192143d..2bf22ea 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -139,9 +139,9 @@ namespace Marco.Pms.Services.Controllers } [HttpDelete("{id}")] - public async Task DeleteContact(Guid id) + public async Task DeleteContact(Guid id, [FromQuery] bool? active) { - var response = await _directoryHelper.DeleteContact(id); + var response = await _directoryHelper.DeleteContact(id, active ?? false); if (response.StatusCode == 200) { return Ok(response); @@ -214,9 +214,9 @@ namespace Marco.Pms.Services.Controllers } [HttpDelete("note/{id}")] - public async Task DeleteContactNote(Guid id) + public async Task DeleteContactNote(Guid id, [FromQuery] bool? active) { - var response = await _directoryHelper.DeleteContactNote(id); + var response = await _directoryHelper.DeleteContactNote(id, active ?? false); return Ok(response); } @@ -315,5 +315,27 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } + + [HttpDelete("bucket/{id}")] + public async Task DeleteBucket(Guid id) + { + var response = await _directoryHelper.DeleteBucket(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 35a11d7..4990d11 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -878,7 +878,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } - public async Task> DeleteContact(Guid id) + public async Task> DeleteContact(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -890,7 +890,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - contact.IsActive = false; + contact.IsActive = active; _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog { @@ -916,7 +916,15 @@ namespace Marco.Pms.Services.Helpers Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); + List notes = new List(); + if (active) + { + notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive && n.TenantId == tenantId).ToListAsync(); + } + else + { + notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); + } List? noteVMs = new List(); foreach (var note in notes) { @@ -989,7 +997,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> DeleteContactNote(Guid id) + public async Task> DeleteContactNote(Guid id, bool active) { Guid tenentId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -997,7 +1005,7 @@ namespace Marco.Pms.Services.Helpers ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); if (note != null) { - note.IsActive = false; + note.IsActive = active; _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog { RefereanceId = id, @@ -1268,6 +1276,66 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteBucket(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + + if (bucket != null) + { + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + + if (contactBuckets.Any()) + { + _logger.LogInfo("Employee {EmployeeId} attempted to deleted bucket {BucketId},but bucket have contacts in it.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("This bucket can not be deleted", "This bucket can not be deleted", 400); + } + + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + + _context.EmployeeBucketMappings.RemoveRange(employeeBuckets); + _context.Buckets.Remove(bucket); + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 453a64fea019f51a490c89615a583989cb779b86 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 10:45:03 +0530 Subject: [PATCH 373/469] Corrected Spelling mistakes --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4990d11..8011fc4 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -999,10 +999,10 @@ namespace Marco.Pms.Services.Helpers } public async Task> DeleteContactNote(Guid id, bool active) { - Guid tenentId = _userHelper.GetTenantId(); + Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); if (note != null) { note.IsActive = active; @@ -1278,10 +1278,10 @@ namespace Marco.Pms.Services.Helpers } public async Task> DeleteBucket(Guid id) { - Guid tenentId = _userHelper.GetTenantId(); + Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); if (bucket != null) { @@ -1330,7 +1330,7 @@ namespace Marco.Pms.Services.Helpers }); await _context.SaveChangesAsync(); _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); } _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); -- 2.43.0 From 197b4aea8df392403c9d09730547a64c47076ceb Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 11:36:40 +0530 Subject: [PATCH 374/469] Sending number of conacts within the bucket with it information in API Update bucket, Assign Bucket, and Get Bucket List --- .../ViewModels/Directory/AssignBucketVM.cs | 1 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs index f4c8e2b..e5c16ab 100644 --- a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -6,5 +6,6 @@ public string? Name { get; set; } public string? Description { get; set; } public List? EmployeeIds { get; set; } + public int NumberOfContacts { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8011fc4..d769a9f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1054,14 +1054,16 @@ namespace Marco.Pms.Services.Helpers List bucketVMs = new List(); if (bucketList.Any()) { + bucketIds = bucketList.Select(b => b.Id).ToList(); + List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); foreach (var bucket in bucketList) { List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); - + List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); bucketVM.EmployeeIds = emplyeeIds; - + bucketVM.NumberOfContacts = contactBuckets.Count; bucketVMs.Add(bucketVM); } } @@ -1170,8 +1172,10 @@ namespace Marco.Pms.Services.Helpers AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); bucketVM.EmployeeIds = employeeIds; + bucketVM.NumberOfContacts = contactBuckets.Count; _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); @@ -1259,9 +1263,10 @@ namespace Marco.Pms.Services.Helpers AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); + List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); bucketVM.EmployeeIds = employeeIds; - + bucketVM.NumberOfContacts = contactBuckets.Count; if (assignedEmployee > 0) { -- 2.43.0 From a48d4d308ff6c262a3b0f64e14700519e7cd526f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 12:48:02 +0530 Subject: [PATCH 375/469] Included object consist of basic infromation of employee who created the bucket in View models --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 6 ++++-- Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs | 5 ++++- Marco.Pms.Model/ViewModels/Directory/BucketVM.cs | 5 ++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++----- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2aea3c0..4732542 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -199,7 +199,8 @@ namespace Marco.Pms.Model.Mapper { Id = bucket.Id, Name = bucket.Name, - Description = bucket.Description + Description = bucket.Description, + CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null }; } public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) @@ -208,7 +209,8 @@ namespace Marco.Pms.Model.Mapper { Id = bucket.Id, Name = bucket.Name, - Description = bucket.Description + Description = bucket.Description, + CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null }; } diff --git a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs index e5c16ab..1458cfb 100644 --- a/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/AssignBucketVM.cs @@ -1,10 +1,13 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class AssignBucketVM { public Guid Id { get; set; } public string? Name { get; set; } public string? Description { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } public List? EmployeeIds { get; set; } public int NumberOfContacts { get; set; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs index ce9ed9e..a266658 100644 --- a/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/BucketVM.cs @@ -1,9 +1,12 @@ -namespace Marco.Pms.Model.ViewModels.Directory +using Marco.Pms.Model.ViewModels.Activities; + +namespace Marco.Pms.Model.ViewModels.Directory { public class BucketVM { public Guid Id { get; set; } public string? Name { get; set; } public string? Description { get; set; } + public BasicEmployeeVM? CreatedBy { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d769a9f..d91fc1f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1039,11 +1039,11 @@ namespace Marco.Pms.Services.Helpers List bucketList = new List(); if (permissionIds.Contains(directoryAdmin)) { - bucketList = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => b.TenantId == tenantId).ToListAsync(); } else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) { - bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); } else { @@ -1110,7 +1110,7 @@ namespace Marco.Pms.Services.Helpers _context.EmployeeBucketMappings.Add(employeeBucket); await _context.SaveChangesAsync(); - + bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucket.Id) ?? new Bucket(); BucketVM bucketVM = bucket.ToBucketVMFromBucket(); _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); @@ -1128,7 +1128,7 @@ namespace Marco.Pms.Services.Helpers var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); if (bucket == null) { @@ -1192,7 +1192,7 @@ namespace Marco.Pms.Services.Helpers var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); + Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); if (bucket == null) { -- 2.43.0 From d60608e5446deb93f7516d85389adc6262009311 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:00:56 +0530 Subject: [PATCH 376/469] Sending last updatedBy and updatedAt when sending list of notes --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d91fc1f..c208db2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -925,11 +925,25 @@ namespace Marco.Pms.Services.Helpers { notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); } + var noteIds = notes.Select(n => n.Id).ToList(); + List? updateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.RefereanceId)).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + DirectoryUpdateLog? updateLog = updateLogs.Where(l => l.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + if (updateLog != null) + { + noteVM.UpdatedAt = updateLog.UpdateAt; + noteVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + else + { + noteVM.UpdatedAt = note.CreatedAt; + noteVM.UpdatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null; + } noteVMs.Add(noteVM); + } _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); -- 2.43.0 From f0bf5dca831a8fdad375dcecd6ed79b5cd86281d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:14:31 +0530 Subject: [PATCH 377/469] Stopping multiple entries in employee-bucket mapping table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index c208db2..df55a35 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1215,7 +1215,7 @@ namespace Marco.Pms.Services.Helpers } var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - + var employeeBucketIds = employeeBuckets.Select(eb => eb.EmployeeId).ToList(); Bucket? accessableBucket = null; if (permissionIds.Contains(directoryAdmin)) { @@ -1244,7 +1244,7 @@ namespace Marco.Pms.Services.Helpers { if (employeeIds.Contains(assignBucket.EmployeeId)) { - if (assignBucket.IsActive) + if (assignBucket.IsActive && !employeeBucketIds.Contains(assignBucket.EmployeeId)) { EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping { -- 2.43.0 From 621b96a805f128fa32458fc80b78d5603743957b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:55:00 +0530 Subject: [PATCH 378/469] fixed the bug of only sending ID of logged in employee in Bucket object --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index df55a35..69b0b5d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1049,7 +1049,7 @@ namespace Marco.Pms.Services.Helpers List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - + List employeeBucketVM = await _context.EmployeeBucketMappings.Where(b => bucketIds.Contains(b.BucketId)).ToListAsync(); List bucketList = new List(); if (permissionIds.Contains(directoryAdmin)) { @@ -1072,7 +1072,7 @@ namespace Marco.Pms.Services.Helpers List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); foreach (var bucket in bucketList) { - List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + List employeeBucketMappings = employeeBucketVM.Where(eb => eb.BucketId == bucket.Id).ToList(); var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); -- 2.43.0 From ccef0ba192902458bb004f7fa9c64baaae585299 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 379/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 6 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactTagMapping.cs | 2 +- .../Dtos/Directory/CreateBucketDto.cs | 4 +- .../Dtos/Directory/CreateContactDto.cs | 7 +- .../Dtos/Directory/CreateContactEmailDto.cs | 1 + .../Dtos/Directory/CreateContactPhoneDto.cs | 1 + .../Dtos/Directory/UpdateContactDto.cs | 4 +- .../Dtos/Directory/UpdateContactEmailDto.cs | 2 +- .../Dtos/Directory/UpdateContactPhoneDto.cs | 2 +- .../Dtos/Master/CreateContactTagDto.cs | 1 - .../Dtos/Master/UpdateContactTagDto.cs | 1 - Marco.Pms.Model/Mapper/DirectoryMapper.cs | 79 ++----------------- .../ViewModels/Directory/ContactVM.cs | 5 +- .../ViewModels/Master/ContactTagVM.cs | 1 - 15 files changed, 24 insertions(+), 94 deletions(-) diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs index 0d382c5..028b428 100644 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -1,5 +1,4 @@ -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.Utilities; namespace Marco.Pms.Model.Directory { @@ -7,9 +6,6 @@ namespace Marco.Pms.Model.Directory { public Guid Id { get; set; } public string Name { get; set; } = string.Empty; - public Guid CreatedByID { get; set; } - public Employee? CreatedBy { get; set; } - public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs index 91c2835..a3d7e9e 100644 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -5,7 +5,7 @@ public Guid Id { get; set; } public Guid ContactId { get; set; } public Contact? Contact { get; set; } - public Guid ContactTagId { get; set; } + public Guid ContactTagtId { get; set; } public ContactTagMaster? ContactTag { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs index 0c02457..ba0918d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -2,7 +2,7 @@ { public class CreateBucketDto { - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..42937c0 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,15 +2,14 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public List? BucketIds { get; set; } - public Guid? ContactCategoryId { get; set; } + public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? Tags { get; set; } + public List? TagIds { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 654890a..e33cdb6 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,7 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index a72ac3d..dc97881 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,5 +4,6 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..7c93cce 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } @@ -12,6 +12,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? Tags { get; set; } + public List? TagIds { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs index 186f5b3..8ece036 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactEmailDto { - public Guid? Id { get; set; } + public Guid Id { get; set; } public string? Label { get; set; } public string? EmailAddress { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs index ff0ec23..1ddfb14 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactPhoneDto { - public Guid? Id { get; set; } + public Guid Id { get; set; } public string? Label { get; set; } public string? PhoneNumber { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs index 2fec4ae..ad91ca7 100644 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -3,6 +3,5 @@ public class CreateContactTagDto { public string? Name { get; set; } - public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs index e97ece6..0406a6c 100644 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -4,6 +4,5 @@ { public Guid Id { get; set; } public string? Name { get; set; } - public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 4732542..41fa9c5 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -8,31 +8,29 @@ namespace Marco.Pms.Model.Mapper { public static class DirectoryMapper { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId, Guid employeeId) + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) { return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, Organization = createContactDto?.Organization ?? string.Empty, Address = createContactDto != null ? createContactDto.Address : string.Empty, - CreatedById = employeeId, - CreatedAt = DateTime.UtcNow, TenantId = tenantId }; } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId, Contact contact) + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) { return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, - CreatedAt = contact.CreatedAt, - CreatedById = contact.CreatedById, Description = updateContactDto.Description ?? string.Empty, Organization = updateContactDto?.Organization ?? string.Empty, Address = updateContactDto != null ? updateContactDto.Address : string.Empty, @@ -44,27 +42,14 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty }; } - public static ContactProfileVM ToContactProfileVMFromContact(this Contact contact) - { - return new ContactProfileVM - { - Id = contact.Id, - Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, - Description = contact.Description ?? string.Empty, - Organization = contact.Organization ?? string.Empty, - Address = contact.Address ?? string.Empty, - CreatedAt = contact.CreatedAt, - CreatedBy = contact.CreatedBy != null ? contact.CreatedBy.ToBasicEmployeeVMFromEmployee() : null - }; - } //Contact Phone Mapper public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) @@ -81,7 +66,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactPhone { - Id = updateContactPhoneDto.Id ?? Guid.Empty, + Id = updateContactPhoneDto.Id, Label = updateContactPhoneDto.Label ?? string.Empty, PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, ContactId = contactId, @@ -114,7 +99,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactEmail { - Id = updateContactEmailDto.Id ?? Guid.Empty, + Id = updateContactEmailDto.Id, Label = updateContactEmailDto.Label ?? string.Empty, EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, ContactId = contactId, @@ -148,7 +133,6 @@ namespace Marco.Pms.Model.Mapper { Id = updateContactTagDto.Id, Name = updateContactTagDto.Name ?? string.Empty, - Description = updateContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -157,7 +141,6 @@ namespace Marco.Pms.Model.Mapper return new ContactTagVM { Id = contactTag.Id, - Description = contactTag.Description ?? string.Empty, Name = contactTag.Name ?? string.Empty, }; } @@ -191,51 +174,5 @@ namespace Marco.Pms.Model.Mapper Description = contactType.Description ?? string.Empty, }; } - - // Bucket - public static BucketVM ToBucketVMFromBucket(this Bucket bucket) - { - return new BucketVM - { - Id = bucket.Id, - Name = bucket.Name, - Description = bucket.Description, - CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null - }; - } - public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) - { - return new AssignBucketVM - { - Id = bucket.Id, - Name = bucket.Name, - Description = bucket.Description, - CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null - }; - } - - //Contact Note - public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) - { - return new ContactNote - { - Note = noteDto.Note, - ContactId = noteDto.ContactId, - CreatedAt = DateTime.UtcNow, - CreatedById = employeeId, - TenantId = tenantId - }; - } - public static ContactNoteVM ToContactNoteVMFromContactNote(this ContactNote note) - { - return new ContactNoteVM - { - Id = note.Id, - Note = note.Note, - ContactId = note.ContactId, - CreatedAt = note.CreatedAt, - CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null - }; - } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..6d6f82e 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } + public ContactCategoryVM? ContactType { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs index 321b669..2cb6f8a 100644 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -4,6 +4,5 @@ { public Guid Id { get; set; } public string? Name { get; set; } - public string? Description { get; set; } } } -- 2.43.0 From 8da02932e443472de5a8c7959532779e53fc06b7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:27:36 +0530 Subject: [PATCH 380/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs | 1 - Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs | 1 - Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 - 3 files changed, 3 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index e33cdb6..68bb2b2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -7,4 +7,3 @@ public Guid? ContactId { get; set; } } } - diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 7c93cce..042150d 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -7,7 +7,6 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public List? BucketIds { get; set; } public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 41fa9c5..048a0d2 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -123,7 +123,6 @@ namespace Marco.Pms.Model.Mapper return new ContactTagMaster { Name = createContactTagDto.Name ?? string.Empty, - Description = createContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } -- 2.43.0 From 52e9cb7de946d7ab04e43e98733e26531a645bb2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:38:47 +0530 Subject: [PATCH 381/469] Added Directory controller file --- .../Controllers/DirectoryController.cs | 335 +----------------- 1 file changed, 2 insertions(+), 333 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 2bf22ea..77a183c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,341 +1,10 @@ -using Marco.Pms.Model.Dtos.Directory; -using Marco.Pms.Model.Utilities; -using Marco.Pms.Services.Helpers; -using MarcoBMS.Services.Service; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { - [ApiController] [Route("api/[controller]")] - [Authorize] - + [ApiController] public class DirectoryController : ControllerBase { - - private readonly DirectoryHelper _directoryHelper; - private readonly ILoggingService _logger; - - - public DirectoryController(DirectoryHelper directoryHelper, ILoggingService logger) - { - _directoryHelper = directoryHelper; - _logger = logger; - } - - [HttpGet] - public async Task GetContactList([FromQuery] string? search, [FromQuery] List? bucketIds, [FromQuery] List? categoryIds, [FromQuery] Guid? projectId, [FromQuery] bool active = true) - { - ContactFilterDto filterDto = new ContactFilterDto - { - BucketIds = bucketIds, - CategoryIds = categoryIds - }; - var response = await _directoryHelper.GetListOfContacts(search, active, filterDto, projectId); - - - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - - } - - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - - [HttpPost] - public async Task CreateContact([FromBody] CreateContactDto createContact) - { - if (!ModelState.IsValid) - { - var errors = ModelState.Values - .SelectMany(v => v.Errors) - .Select(e => e.ErrorMessage) - .ToList(); - _logger.LogError("User sent Invalid Date while marking attendance"); - return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); - } - var response = await _directoryHelper.CreateContact(createContact); - if (response.StatusCode == 200) - { - return Ok(response); - } - else - { - return BadRequest(response); - } - } - - [HttpPut("{id}")] - public async Task UpdateContact(Guid id, [FromBody] UpdateContactDto updateContact) - { - var response = await _directoryHelper.UpdateContact(id, updateContact); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - - [HttpGet("profile/{id}")] - public async Task GetContactProfile(Guid id) - { - var response = await _directoryHelper.GetContactProfile(id); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else - { - return BadRequest(response); - } - } - - [HttpGet("organization")] - public async Task GetOrganizationList() - { - var response = await _directoryHelper.GetOrganizationList(); - return Ok(response); - } - - [HttpDelete("{id}")] - public async Task DeleteContact(Guid id, [FromQuery] bool? active) - { - var response = await _directoryHelper.DeleteContact(id, active ?? false); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else - { - return BadRequest(response); - } - } - - // -------------------------------- Contact Notes -------------------------------- - - [HttpPost("note")] - public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) - { - - var response = await _directoryHelper.CreateContactNote(noteDto); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else - { - return BadRequest(response); - } - } - - [HttpGet("notes/{ContactId}")] - public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) - { - var response = await _directoryHelper.GetNoteListByContactId(contactId, active); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else - { - return BadRequest(response); - } - } - - [HttpPut("note/{id}")] - public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) - { - var response = await _directoryHelper.UpdateContactNote(id, noteDto); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else - { - return BadRequest(response); - } - } - - [HttpDelete("note/{id}")] - public async Task DeleteContactNote(Guid id, [FromQuery] bool? active) - { - var response = await _directoryHelper.DeleteContactNote(id, active ?? false); - return Ok(response); - } - - // -------------------------------- Bucket -------------------------------- - - [HttpGet("buckets")] - public async Task GetBucketList() - { - var response = await _directoryHelper.GetBucketList(); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - - [HttpPost("bucket")] - public async Task CreateBucket(CreateBucketDto bucketDto) - { - if (!ModelState.IsValid) - { - var errors = ModelState.Values - .SelectMany(v => v.Errors) - .Select(e => e.ErrorMessage) - .ToList(); - _logger.LogError("User sent Invalid Date while marking attendance"); - return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); - } - var response = await _directoryHelper.CreateBucket(bucketDto); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 409) - { - return Conflict(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - - } - - [HttpPut("bucket/{id}")] - public async Task UpdateBucket(Guid id, [FromBody] UpdateBucketDto bucketDto) - { - var response = await _directoryHelper.UpdateBucket(id, bucketDto); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - - [HttpPost("assign-bucket/{bucketId}")] - public async Task AssignBucket(Guid bucketId, [FromBody] List assignBuckets) - { - var response = await _directoryHelper.AssignBucket(bucketId, assignBuckets); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - - [HttpDelete("bucket/{id}")] - public async Task DeleteBucket(Guid id) - { - var response = await _directoryHelper.DeleteBucket(id); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 404) - { - return NotFound(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } } } -- 2.43.0 From a23c8c3ff0a73f0dfe4dd0e2849a45373421b39c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:44:30 +0530 Subject: [PATCH 382/469] An API skeleton has been added. --- .../Controllers/DirectoryController.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 77a183c..b0de798 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,4 +1,8 @@ -using Microsoft.AspNetCore.Mvc; +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Dtos.Directory; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { @@ -6,5 +10,32 @@ namespace Marco.Pms.Services.Controllers [ApiController] public class DirectoryController : ControllerBase { + + private readonly ApplicationDbContext _context; + private readonly ILoggingService _logger; + private readonly UserHelper _userHelper; + + + public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + { + _context = context; + _logger = logger; + _userHelper = userHelper; + } + + [HttpGet] + public async Task GetContactList() + { + return Ok(); + } + + [HttpPost] + public async Task CreateContact([FromBody] CreateContactDto createContact) + { + return Ok(); + } + { + return Ok(); } } +} -- 2.43.0 From b5ce7eb73f43031008f09b23abceaeb15ab5e463 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 16:10:07 +0530 Subject: [PATCH 383/469] Added Migration for contact related tables --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 048a0d2..d66615a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -44,7 +44,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty -- 2.43.0 From 58b0a3fbaa7d60e22f470112556e9d05f81a1900 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 17:51:57 +0530 Subject: [PATCH 384/469] Added DirectoryHelper in helper folder --- .../Dtos/Directory/CreateContactDto.cs | 3 +- .../Dtos/Directory/UpdateContactDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 ++- .../Controllers/DirectoryController.cs | 34 ++++++++++++------- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 42937c0..6e962a4 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -6,7 +6,8 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public Guid ContactCategoryId { get; set; } + public List? BucketIds { get; set; } + public Guid? ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 042150d..7c93cce 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -7,6 +7,7 @@ public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } + public List? BucketIds { get; set; } public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index d66615a..abf72d3 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -8,7 +8,7 @@ namespace Marco.Pms.Model.Mapper { public static class DirectoryMapper { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId, Guid employeeId) { return new Contact @@ -19,6 +19,8 @@ namespace Marco.Pms.Model.Mapper Description = createContactDto.Description ?? string.Empty, Organization = createContactDto?.Organization ?? string.Empty, Address = createContactDto != null ? createContactDto.Address : string.Empty, + CreatedById = employeeId, + CreatedAt = DateTime.UtcNow, TenantId = tenantId }; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b0de798..a2f984c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -1,26 +1,25 @@ -using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Dtos.Directory; -using MarcoBMS.Services.Helpers; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { - [Route("api/[controller]")] [ApiController] + [Route("api/[controller]")] + public class DirectoryController : ControllerBase { - private readonly ApplicationDbContext _context; + private readonly DirectoryHelper _directoryHelper; private readonly ILoggingService _logger; - private readonly UserHelper _userHelper; - public DirectoryController(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper) + public DirectoryController(DirectoryHelper directoryHelper, ILoggingService logger) { - _context = context; + _directoryHelper = directoryHelper; _logger = logger; - _userHelper = userHelper; } [HttpGet] @@ -32,10 +31,21 @@ namespace Marco.Pms.Services.Controllers [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + return Ok(); } - { - return Ok(); + + + + } } -} -- 2.43.0 From 9d67a25488e3bb661f5d1f426996e810a4faa09d Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 385/469] created GetListOfContact custome function --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../ViewModels/Directory/ContactVM.cs | 2 +- .../Controllers/DirectoryController.cs | 13 ++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 87 ++++++++++++++++++- 4 files changed, 99 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index abf72d3..fbe0e46 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index 6d6f82e..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.ViewModels.Directory public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactType { get; set; } + public ContactCategoryVM? ContactCategory { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a2f984c..efa76c3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,7 +25,18 @@ namespace Marco.Pms.Services.Controllers [HttpGet] public async Task GetContactList() { - return Ok(); + var response = await _directoryHelper.GetListOfContacts(); + + + if(response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 69b0b5d..b50eae9 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -9,7 +9,6 @@ using Marco.Pms.Model.ViewModels.Master; using Marco.Pms.Model.ViewModels.Projects; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; -using Microsoft.EntityFrameworkCore; namespace Marco.Pms.Services.Helpers { @@ -1364,5 +1363,89 @@ namespace Marco.Pms.Services.Helpers bool result = sentence.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; return result; } + + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + + List contactIds = contacts.Select(c=>c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); + + var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); + + + List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if(emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if(phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + + if (tagMappingss != null) { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag.ToContactTagVMFromContactTagMaster(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + + return ApiResponse.SuccessResponse(list, "Contact List !",200); + + } } -} + } -- 2.43.0 From f2699898ede50811473994fc237a690932c9f9a8 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 386/469] Added an API to create contact and populate related tables as well --- .../Dtos/Directory/CreateContactEmailDto.cs | 2 +- .../Dtos/Directory/CreateContactPhoneDto.cs | 1 - .../Controllers/DirectoryController.cs | 11 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 109 ++++++++++++++++++ 4 files changed, 119 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 68bb2b2..654890a 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,6 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } - public Guid? ContactId { get; set; } } } + diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index dc97881..a72ac3d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,6 +4,5 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } - public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index efa76c3..afcb061 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -51,8 +51,15 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("User sent Invalid Date while marking attendance"); return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); } - - return Ok(); + var response = await _directoryHelper.CreateContact(createContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b50eae9..fffc255 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1447,5 +1447,114 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, "Contact List !",200); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } -- 2.43.0 From 3d9e22c308b293d1be380be50a0de2c77637ca3b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 387/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 84 ------------------- 1 file changed, 84 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index fffc255..9a25f98 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1364,90 +1364,6 @@ namespace Marco.Pms.Services.Helpers return result; } - - - public async Task> GetListOfContacts() - { - Guid tenantId = _userHelper.GetTenantId(); - - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - - List contactIds = contacts.Select(c=>c.Id).ToList(); - - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - - var Emails = await _context.ContactsEmails.Where(E=> contactIds.Contains(E.ContactId)).ToListAsync(); - - var Tags = await _context.ContactTagMappings.Where(t=>contactIds.Contains(t.ContactId)).ToListAsync(); - - - List TagIds = Tags.Select(t=>t.ContactTagtId).ToList(); - - var TagList = await _context.ContactTagMasters.Where(t=> TagIds.Contains(t.Id)).ToListAsync(); - - List list = new List(); - - foreach (var contact in contacts) - { - - ContactVM contactVM = new ContactVM(); - List contactEmailVms = new List(); - List contactPhoneVms = new List(); - - List conatctTagVms = new List(); - var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); - var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); - var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - - - if(emails != null) - { - foreach (var email in emails) - { - ContactEmailVM emailVM = new ContactEmailVM(); - emailVM = email.ToContactEmailVMFromContactEmail(); - contactEmailVms.Add(emailVM); - } - } - - if(phones != null) - { - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = new ContactPhoneVM(); - phoneVM = phone.ToContactPhoneVMFromContactPhone(); - contactPhoneVms.Add(phoneVM); - } - - } - - if (tagMappingss != null) { - foreach (var tagMapping in tagMappingss) - { - ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); - - tagVM = tag.ToContactTagVMFromContactTagMaster(); - conatctTagVms.Add(tagVM); - - - } - } - - - contactVM = contact.ToContactVMFromContact(); - - contactVM.ContactEmails = contactEmailVms; - contactVM.ContactPhones = contactPhoneVms; - contactVM.Tags = conatctTagVms; - - list.Add(contactVM); - } - - return ApiResponse.SuccessResponse(list, "Contact List !",200); - - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 47d7cbba4f1b3caf7d0dc090e66f32f29bf4cb4d Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 388/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 2 +- .../Controllers/DirectoryController.cs | 6 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 81 ++++++++++++++++++- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index fbe0e46..b9e9f86 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -46,7 +46,7 @@ namespace Marco.Pms.Model.Mapper Id = contact.Id, ProjectId = contact.ProjectId, Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : new ContactCategoryVM(), + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index afcb061..b5ac7e5 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -2,12 +2,14 @@ using Marco.Pms.Model.Utilities; using Marco.Pms.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Marco.Pms.Services.Controllers { [ApiController] [Route("api/[controller]")] + [Authorize] public class DirectoryController : ControllerBase { @@ -28,7 +30,7 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetListOfContacts(); - if(response.StatusCode == 200) + if (response.StatusCode == 200) { return Ok(response); } @@ -36,7 +38,7 @@ namespace Marco.Pms.Services.Controllers { return BadRequest(response); } - + } [HttpPost] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 9a25f98..7fa52eb 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1364,6 +1364,85 @@ namespace Marco.Pms.Services.Helpers return result; } + + + public async Task> GetListOfContacts() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); + + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); + var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + + var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + + List list = new List(); + + foreach (var contact in contacts) + { + + ContactVM contactVM = new ContactVM(); + List contactEmailVms = new List(); + List contactPhoneVms = new List(); + + List conatctTagVms = new List(); + var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); + var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); + var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + + + if (emails != null) + { + foreach (var email in emails) + { + ContactEmailVM emailVM = new ContactEmailVM(); + emailVM = email.ToContactEmailVMFromContactEmail(); + contactEmailVms.Add(emailVM); + } + } + + if (phones != null) + { + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = new ContactPhoneVM(); + phoneVM = phone.ToContactPhoneVMFromContactPhone(); + contactPhoneVms.Add(phoneVM); + } + + } + if (tagMappingss != null) + { + foreach (var tagMapping in tagMappingss) + { + ContactTagVM tagVM = new ContactTagVM(); ; + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + conatctTagVms.Add(tagVM); + + + } + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = contactEmailVms; + contactVM.ContactPhones = contactPhoneVms; + contactVM.Tags = conatctTagVms; + + list.Add(contactVM); + } + _logger.LogInfo("{count} contacts are fetched by Employee with ID {LoggedInEmployeeId}", list.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); + + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -1473,4 +1552,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From bab5243108340b1dddf81bd02fb4d35b21bfbfe7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 12:51:23 +0530 Subject: [PATCH 389/469] Created an API to create the Contact category --- Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs | 1 + Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs | 1 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 +++ Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs | 1 + 4 files changed, 6 insertions(+) diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs index ad91ca7..2fec4ae 100644 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -3,5 +3,6 @@ public class CreateContactTagDto { public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs index 0406a6c..e97ece6 100644 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b9e9f86..82e703f 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -125,6 +125,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagMaster { Name = createContactTagDto.Name ?? string.Empty, + Description = createContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -134,6 +135,7 @@ namespace Marco.Pms.Model.Mapper { Id = updateContactTagDto.Id, Name = updateContactTagDto.Name ?? string.Empty, + Description = updateContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -142,6 +144,7 @@ namespace Marco.Pms.Model.Mapper return new ContactTagVM { Id = contactTag.Id, + Description = contactTag.Description ?? string.Empty, Name = contactTag.Name ?? string.Empty, }; } diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs index 2cb6f8a..321b669 100644 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -4,5 +4,6 @@ { public Guid Id { get; set; } public string? Name { get; set; } + public string? Description { get; set; } } } -- 2.43.0 From 4f250ab46ee4824eb32509ce1266c9c167554e23 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 390/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 55883f6..df9cee1 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,6 +144,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 76671bc5dc2497b28fc22090dca54720c09e407e Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 391/469] Added an API to update existing contact --- .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactEmailDto.cs | 2 +- .../Dtos/Directory/UpdateContactPhoneDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +- .../Controllers/DirectoryController.cs | 18 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 7 files changed, 250 insertions(+), 13 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 6e962a4..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -11,6 +11,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index 7c93cce..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -12,6 +12,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? TagIds { get; set; } + public List? Tags { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs index 8ece036..186f5b3 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactEmailDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? EmailAddress { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs index 1ddfb14..ff0ec23 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactPhoneDto { - public Guid Id { get; set; } + public Guid? Id { get; set; } public string? Label { get; set; } public string? PhoneNumber { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 82e703f..9b5c835 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -68,7 +68,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactPhone { - Id = updateContactPhoneDto.Id, + Id = updateContactPhoneDto.Id ?? Guid.Empty, Label = updateContactPhoneDto.Label ?? string.Empty, PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, ContactId = contactId, @@ -101,7 +101,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactEmail { - Id = updateContactEmailDto.Id, + Id = updateContactEmailDto.Id ?? Guid.Empty, Label = updateContactEmailDto.Label ?? string.Empty, EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, ContactId = contactId, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b5ac7e5..fe82bce 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -64,7 +64,23 @@ namespace Marco.Pms.Services.Controllers } } - + [HttpPut("{id}")] + public async Task UpdateContact(Guid id, [FromBody] UpdateContactDto updateContact) + { + var response = await _directoryHelper.UpdateContact(id, updateContact); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 7fa52eb..fb68e67 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1501,17 +1501,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -1548,8 +1563,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From 6e0cdbcfe38df68227eccdc3897f33de376b3cb1 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 392/469] added api to get list of contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index df9cee1..36f6878 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Employees; -- 2.43.0 From 9e813c1e519bcd022991382cb7766591cfbe8fbf Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 393/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 11 ++++++++++ .../Controllers/DirectoryController.cs | 6 +++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 9b5c835..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -178,5 +178,16 @@ namespace Marco.Pms.Model.Mapper Description = contactType.Description ?? string.Empty, }; } + + // Bucket + public static BucketVM ToBucketVMFromBucket(this Bucket bucket) + { + return new BucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fe82bce..65ccd2d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -83,5 +83,11 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("buckets")] + public async Task GetBucketList() + { + var response = await _directoryHelper.GetBucketList(); + return Ok(response); + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index fb68e67..a922c3f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1772,5 +1772,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From 9c25aa1aabcc8033d8585d5a412f9059d5bb5cb5 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 394/469] Added an API to create a contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 36f6878..df9cee1 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Employees; -- 2.43.0 From bea8793fba2051173e58ae95be5bfabc208a6e49 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 395/469] Added an API to create bucket --- .../Dtos/Directory/CreateBucketDto.cs | 4 +- .../Controllers/DirectoryController.cs | 28 ++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs index ba0918d..0c02457 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -2,7 +2,7 @@ { public class CreateBucketDto { - public string name { get; set; } = string.Empty; - public string description { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 65ccd2d..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -89,5 +89,33 @@ namespace Marco.Pms.Services.Controllers var response = await _directoryHelper.GetBucketList(); return Ok(response); } + + [HttpPost("bucket")] + public async Task CreateBucket(CreateBucketDto bucketDto) + { + if (!ModelState.IsValid) + { + var errors = ModelState.Values + .SelectMany(v => v.Errors) + .Select(e => e.ErrorMessage) + .ToList(); + _logger.LogError("User sent Invalid Date while marking attendance"); + return BadRequest(ApiResponse.ErrorResponse("Invalid data", errors, 400)); + } + var response = await _directoryHelper.CreateBucket(bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 409) + { + return Conflict(response); + } + else + { + return BadRequest(response); + } + + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a922c3f..345dd99 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1794,5 +1794,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From 81d3e016c21b13d17118793e8816ae0ef49a34a7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 396/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 345dd99..3c67585 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1716,7 +1716,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 9da45240c37cd4559fc9aa08db673aa75c038841 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 397/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 2 +- .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 11 files changed, 3343 insertions(+), 21 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 1cedb09..c7918dc 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..aa1ef35 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,6 +41,24 @@ namespace Marco.Pms.Services.Controllers } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 3c67585..bbef1a2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1370,13 +1370,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -1394,9 +1400,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -1406,7 +1413,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -1416,7 +1423,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -1429,9 +1436,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -1443,6 +1458,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -1462,6 +1573,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -1484,6 +1597,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -1499,8 +1613,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -1518,7 +1653,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -1529,12 +1665,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -1560,6 +1704,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -1578,7 +1724,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -1598,6 +1744,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -1685,6 +1834,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -1703,7 +1879,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -1716,7 +1893,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -1738,6 +1915,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -1766,6 +1947,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 5f2626db88dec3f7ccc7d84102f2907da2df7143 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 398/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 +- 12 files changed, 23 insertions(+), 3415 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index c7918dc..1cedb09 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 2f999d2..0430289 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,6 +390,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -545,32 +548,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2701,33 +2678,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..b5d6667 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -42,6 +44,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index aa1ef35..749061f 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -41,24 +41,6 @@ namespace Marco.Pms.Services.Controllers } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index bbef1a2..3c67585 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1370,19 +1370,13 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - - List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -1400,10 +1394,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -1413,7 +1406,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -1423,7 +1416,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -1436,17 +1429,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -1458,102 +1443,6 @@ namespace Marco.Pms.Services.Helpers } - public async Task> GetContactsListByBucketId(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); - if (employeeBucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); - } - List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); - List contactVMs = new List(); - if (contactBucket.Count > 0) - { - var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); - List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); - List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); - - List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); - List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - - List tagIds = new List(); - List tagMasters = new List(); - if (tags.Count > 0) - { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); - tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - } - - if (contacts.Count > 0) - { - - - foreach (var contact in contacts) - { - List? emailVMs = new List(); - List? phoneVMs = new List(); - List? tagVMs = new List(); - - List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); - List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); - - List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); - List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); - List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); - - if (contactPhones.Count > 0) - { - foreach (var phone in contactPhones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - } - if (contactEmails.Count > 0) - { - foreach (var email in contactEmails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - } - if (contactTags.Count > 0) - { - foreach (var contactTag in contactTags) - { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); - if (tagMaster != null) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - } - } - ContactVM contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = emailVMs; - contactVM.ContactPhones = phoneVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - contactVMs.Add(contactVM); - } - } - - } - _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); - } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -1573,8 +1462,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -1597,7 +1484,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -1613,29 +1499,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -1653,8 +1518,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -1665,20 +1529,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -1704,8 +1560,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -1724,7 +1578,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -1744,9 +1598,6 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -1834,33 +1685,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } - if (updateContact.ProjectIds != null) - { - foreach (var ProjectId in updateContact.ProjectIds) - { - if (!projectIds.Contains(ProjectId)) - { - _context.ContactProjectMappings.Add(new ContactProjectMapping - { - ProjectId = ProjectId, - ContactId = contact.Id - }); - } - } - - foreach (var projectMapping in contactProjects) - { - if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) - { - _context.ContactProjectMappings.Remove(projectMapping); - } - } - } - else if (contactProjects != null) - { - _context.ContactProjectMappings.RemoveRange(contactProjects); - } - if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -1879,8 +1703,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -1893,7 +1716,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -1915,10 +1738,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -1947,9 +1766,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 3c14df4d5389063f0fcdc8c31685e6e2d2e178e1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:15:23 +0530 Subject: [PATCH 399/469] Added an API to delete existing contact category --- Marco.Pms.Services/Helpers/MasterHelper.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index df9cee1..0aaa8da 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -159,6 +159,39 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); } + public async Task> DeleteContactCategory(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contactCategory != null) + { + List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); + if (existingContacts.Count > 0) + { + List? contacts = new List(); + foreach (var contact in existingContacts) + { + contact.ContactCategoryId = null; + contacts.Add(contact); + } + _context.Contacts.UpdateRange(contacts); + } + _context.ContactCategoryMasters.Remove(contactCategory); + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); + } // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 20b1f45915826d87b9e6b3ebe7e589865e8e9824 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 400/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 ++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 ++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 17 ++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 210 ++++++++++++++++-- 9 files changed, 292 insertions(+), 23 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 0430289..2f999d2 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,9 +390,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -548,6 +545,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2678,6 +2701,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index b5d6667..71a0f6a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, Description = updateContactDto.Description ?? string.Empty, @@ -44,7 +42,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 749061f..bd49e18 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -40,6 +40,23 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 3c67585..bbef1a2 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1370,13 +1370,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); + List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var contacts = await _context.Contacts.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactIds = contacts.Select(c => c.Id).ToList(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -1394,9 +1400,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -1406,7 +1413,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -1416,7 +1423,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -1429,9 +1436,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -1443,6 +1458,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -1462,6 +1573,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -1484,6 +1597,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -1499,8 +1613,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -1518,7 +1653,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -1529,12 +1665,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -1560,6 +1704,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -1578,7 +1724,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); @@ -1598,6 +1744,9 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); if (updateContact.ContactPhones != null) @@ -1685,6 +1834,33 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.RemoveRange(contactBuckets); } + if (updateContact.ProjectIds != null) + { + foreach (var ProjectId in updateContact.ProjectIds) + { + if (!projectIds.Contains(ProjectId)) + { + _context.ContactProjectMappings.Add(new ContactProjectMapping + { + ProjectId = ProjectId, + ContactId = contact.Id + }); + } + } + + foreach (var projectMapping in contactProjects) + { + if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) + { + _context.ContactProjectMappings.Remove(projectMapping); + } + } + } + else if (contactProjects != null) + { + _context.ContactProjectMappings.RemoveRange(contactProjects); + } + if (updateContact.Tags != null) { var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); @@ -1703,7 +1879,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -1716,7 +1893,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -1738,6 +1915,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -1766,6 +1947,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From a00ef4313a224329578c562fa8cbfd442cd91574 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:28:54 +0530 Subject: [PATCH 401/469] Refetched the contact in update contact API --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index bbef1a2..7a26a38 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1732,6 +1732,7 @@ namespace Marco.Pms.Services.Helpers } var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + _context.Contacts.Update(newContact); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -1912,6 +1913,7 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From eac2c31ea462e69b7b51329463633e40272e7c64 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 402/469] properly mapped the updated Dto to contact table --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 4 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 71a0f6a..f78c260 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -23,7 +23,7 @@ namespace Marco.Pms.Model.Mapper TenantId = tenantId }; } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId, Contact contact) { return new Contact @@ -31,6 +31,8 @@ namespace Marco.Pms.Model.Mapper Id = updateContactDto.Id, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, + CreatedAt = contact.CreatedAt, + CreatedById = contact.CreatedById, Description = updateContactDto.Description ?? string.Empty, Organization = updateContactDto?.Organization ?? string.Empty, Address = updateContactDto != null ? updateContactDto.Address : string.Empty, diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 7a26a38..fb16e31 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1724,15 +1724,16 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + Contact? contact = await _context.Contacts.AsNoTracking().FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact == null) { _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); + await _context.SaveChangesAsync(); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -1844,7 +1845,8 @@ namespace Marco.Pms.Services.Helpers _context.ContactProjectMappings.Add(new ContactProjectMapping { ProjectId = ProjectId, - ContactId = contact.Id + ContactId = contact.Id, + TenantId = tenantId }); } } @@ -1911,7 +1913,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 42b5478b525ff67a4dfa3b0fa0641c2b91440ba2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 403/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index fb16e31..ab3047e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1375,7 +1375,7 @@ namespace Marco.Pms.Services.Helpers List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); @@ -1457,7 +1457,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -1572,6 +1571,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); @@ -1640,14 +1640,14 @@ namespace Marco.Pms.Services.Helpers { foreach (var tag in createContact.Tags) { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) + if (tagNames.Contains(tag.Name.ToLower())) { - ContactTagMapping tagMapping = new ContactTagMapping + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); + _context.ContactTagMappings.Add(new ContactTagMapping { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); + ContactId = contact.Id, + ContactTagtId = tag.Id ?? existingTag.Id + }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) { @@ -1712,7 +1712,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -1746,10 +1745,12 @@ namespace Marco.Pms.Services.Helpers List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -1869,12 +1870,13 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + if (tagNames.Contains(tag.Name.ToLower())) { + ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id.Value + ContactTagtId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -1913,19 +1915,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From f7543a37a1b50bc474d21c8888a6a0f333407379 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:13:35 +0530 Subject: [PATCH 404/469] added an API to get a list of contact-notes by contact ID --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 22 ++++++ .../Controllers/DirectoryController.cs | 67 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 +++++++ 3 files changed, 112 insertions(+) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index f78c260..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -188,5 +188,27 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + + //Contact Note + public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) + { + return new ContactNote + { + Note = noteDto.Note, + ContactId = noteDto.ContactId, + CreatedAt = DateTime.UtcNow, + CreatedById = employeeId, + TenantId = tenantId + }; + } + public static ContactNoteVM ToContactNoteVMFromContactNote(this ContactNote note) + { + return new ContactNoteVM + { + Id = note.Id, + Note = note.Note, + ContactId = note.ContactId + }; + } } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index bd49e18..dd3785e 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,73 @@ namespace Marco.Pms.Services.Controllers } } + // -------------------------------- Contact Notes -------------------------------- + + [HttpPost("note")] + public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.CreateContactNote(noteDto); + //if (response.StatusCode == 200) + //{ + //return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpGet("note/{ContactId}")] + public async Task GetNoteListByContactId(Guid contactId) + { + var response = await _directoryHelper.GetNoteListByContactId(contactId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + + [HttpPut("note/{id}")] + public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) + { + return Ok(); + //var response = await _directoryHelper.UpdateContactNote(id, noteDto); + //if (response.StatusCode == 200) + //{ + // return Ok(response); + //} + //else if (response.StatusCode == 404) + //{ + // return NotFound(response); + //} + //else + //{ + // return BadRequest(response); + //} + } + + [HttpDelete("note/{id}")] + public async Task DeleteContactNote(Guid id) + { + return Ok(); + //var response = await _directoryHelper.DeleteContactNote(id); + //return Ok(response); + } + + // -------------------------------- Bucket -------------------------------- [HttpGet("buckets")] public async Task GetBucketList() diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ab3047e..49d3785 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1963,6 +1963,29 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + // -------------------------------- Contact Notes -------------------------------- + + public async Task> GetNoteListByContactId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + noteVMs.Add(noteVM); + } + _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 2650bdb17a839472c2d57402bfea4afa06ab8068 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 405/469] Added an API to Update existing Contact-note --- .../Controllers/DirectoryController.cs | 60 +++++++++---------- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 ++++++++++++ 2 files changed, 67 insertions(+), 31 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index dd3785e..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -104,20 +104,20 @@ namespace Marco.Pms.Services.Controllers [HttpPost("note")] public async Task CreateContactNote([FromBody] CreateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.CreateContactNote(noteDto); - //if (response.StatusCode == 200) - //{ - //return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + + var response = await _directoryHelper.CreateContactNote(noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpGet("note/{ContactId}")] @@ -141,28 +141,26 @@ namespace Marco.Pms.Services.Controllers [HttpPut("note/{id}")] public async Task UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto) { - return Ok(); - //var response = await _directoryHelper.UpdateContactNote(id, noteDto); - //if (response.StatusCode == 200) - //{ - // return Ok(response); - //} - //else if (response.StatusCode == 404) - //{ - // return NotFound(response); - //} - //else - //{ - // return BadRequest(response); - //} + var response = await _directoryHelper.UpdateContactNote(id, noteDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } } [HttpDelete("note/{id}")] public async Task DeleteContactNote(Guid id) { - return Ok(); - //var response = await _directoryHelper.DeleteContactNote(id); - //return Ok(response); + var response = await _directoryHelper.DeleteContactNote(id); + return Ok(response); } // -------------------------------- Bucket -------------------------------- diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 49d3785..611c31a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1986,6 +1986,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From c9073652c8b34cfe6cbbb7422d9e7d932872bd27 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 406/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 611c31a..b2ca765 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2023,6 +2023,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From a7f41af44f85c74f8985c9f920868b7f0097c652 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:43 +0530 Subject: [PATCH 407/469] Added an API to add a note to specific contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index b2ca765..8b875f7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1985,7 +1985,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - + public async Task> CreateContactNote(CreateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote note = noteDto.ToContactNoteFromCreateContactNoteDto(tenantId, LoggedInEmployee.Id); + _context.ContactNotes.Add(note); + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + _logger.LogInfo("Employee {EmployeeId} Added note at contact {ContactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note added successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to add a note to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 25c91a64ada504e074c61ca7352506be3bd7e3df Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH 408/469] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..12951b9 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -29,6 +29,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, -- 2.43.0 From 94305f34ed40cf1e3d4d971f7df97f395663cef2 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 11:06:46 +0530 Subject: [PATCH 409/469] created GetListOfContact custome function --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8b875f7..920b01d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2126,4 +2126,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } -} + } -- 2.43.0 From a0bf548e64e4945bdb084d90afdd2f19e37afab6 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 10:52:04 +0530 Subject: [PATCH 410/469] Added an API to create contact and populate related tables as well --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 920b01d..bf5f6aa 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2125,5 +2125,114 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + public async Task> CreateContact(CreateContactDto createContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (createContact != null) + { + List phones = new List(); + List emails = new List(); + List contactBucketMappings = new List(); + List contactTagMappings = new List(); + + Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); + + _context.Contacts.Add(contact); + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); + + var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + if (createContact.ContactPhones != null) + { + + foreach (var contactPhone in createContact.ContactPhones) + { + ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); + phones.Add(phone); + } + _context.ContactsPhones.AddRange(phones); + _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.ContactEmails != null) + { + + foreach (var contactEmail in createContact.ContactEmails) + { + ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); + emails.Add(email); + } + _context.ContactsEmails.AddRange(emails); + _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); + } + if (createContact.BucketIds != null) + { + foreach (var bucket in createContact.BucketIds) + { + if (buckets.Contains(bucket)) + { + ContactBucketMapping bucketMapping = new ContactBucketMapping + { + BucketId = bucket, + ContactId = contact.Id + }; + contactBucketMappings.Add(bucketMapping); + } + } + _context.ContactBucketMappings.AddRange(contactBucketMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + } + if (createContact.TagIds != null) + { + foreach (var tag in createContact.TagIds) + { + if (tags.Where(t => t.Id == tag) != null) + { + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = tag, + ContactId = contact.Id + }; + } + } + _context.ContactTagMappings.AddRange(contactTagMappings); + } + await _context.SaveChangesAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTagMappings) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + + return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); + } + _logger.LogWarning("User send empty payload"); + return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + } } } -- 2.43.0 From 7c1171fbb0290f6889793b7c81bdcb793cfe6341 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 11:38:31 +0530 Subject: [PATCH 411/469] Added logs to the 'Get List of Contacts' endpoint. --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index bf5f6aa..e0a8474 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2235,4 +2235,4 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); } } - } +} -- 2.43.0 From 54c66daa18a49ea1d9032c342b319ef71632d29c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 18:36:44 +0530 Subject: [PATCH 412/469] Added an API to update existing contact --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 233 +++++++++++++++++- 1 file changed, 227 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index e0a8474..962ac96 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2184,17 +2184,32 @@ namespace Marco.Pms.Services.Helpers _context.ContactBucketMappings.AddRange(contactBucketMappings); _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - if (createContact.TagIds != null) + if (createContact.Tags != null) { - foreach (var tag in createContact.TagIds) + foreach (var tag in createContact.Tags) { - if (tags.Where(t => t.Id == tag) != null) + if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) { ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = tag, + ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, ContactId = contact.Id }; + contactTagMappings.Add(tagMapping); + } + else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) + { + var newtag = new ContactTagMaster + { + Name = tag.Name + }; + _context.ContactTagMasters.Add(newtag); + ContactTagMapping tagMapping = new ContactTagMapping + { + ContactTagtId = newtag.Id, + ContactId = contact.Id + }; + contactTagMappings.Add(tagMapping); } } _context.ContactTagMappings.AddRange(contactTagMappings); @@ -2231,8 +2246,214 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } - _logger.LogWarning("User send empty payload"); - return ApiResponse.ErrorResponse("User send empty data", "User send empty data", 400); + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + + public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (updateContact != null) + { + if (updateContact.Id != id) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); + } + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + + List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var phoneIds = phones.Select(p => p.Id).ToList(); + List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + var emailIds = emails.Select(p => p.Id).ToList(); + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + + if (updateContact.ContactPhones != null) + { + var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); + foreach (var phoneDto in updateContact.ContactPhones) + { + var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); + if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Update(phone); + } + else + { + _context.ContactsPhones.Add(phone); + } + } + foreach (var phone in phones) + { + + if (!updatedPhoneIds.Contains(phone.Id)) + { + _context.ContactsPhones.Remove(phone); + } + } + } + else if (phones != null) + { + _context.ContactsPhones.RemoveRange(phones); + } + + if (updateContact.ContactEmails != null) + { + var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); + + foreach (var emailDto in updateContact.ContactEmails) + { + var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); + if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) + { + _context.ContactsEmails.Update(email); + } + else + { + _context.ContactsEmails.Add(email); + } + } + foreach (var email in emails) + { + + if (!updateEmailIds.Contains(email.Id)) + { + _context.ContactsEmails.Remove(email); + } + } + } + else if (emails != null) + { + _context.ContactsEmails.RemoveRange(emails); + } + + if (updateContact.BucketIds != null) + { + foreach (var bucketId in updateContact.BucketIds) + { + if (!bucketIds.Contains(bucketId)) + { + _context.ContactBucketMappings.Add(new ContactBucketMapping + { + BucketId = bucketId, + ContactId = contact.Id + }); + } + } + foreach (var bucketMapping in contactBuckets) + { + if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) + { + _context.ContactBucketMappings.Remove(bucketMapping); + } + } + } + else if (contactBuckets != null) + { + _context.ContactBucketMappings.RemoveRange(contactBuckets); + } + + if (updateContact.Tags != null) + { + var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); + foreach (var tag in updateContact.Tags) + { + if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) + { + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = tag.Id.Value + }); + } + else if (tag.Id == null || tag.Id == Guid.Empty) + { + ContactTagMaster contactTag = new ContactTagMaster + { + Name = tag.Name, + Description = "" + }; + _context.ContactTagMasters.Add(contactTag); + + _context.ContactTagMappings.Add(new ContactTagMapping + { + ContactId = contact.Id, + ContactTagtId = contactTag.Id + }); + } + } + foreach (var contactTag in contactTags) + { + if (!updatedTagIds.Contains(contactTag.Id)) + { + _context.ContactTagMappings.Remove(contactTag); + } + } + } + else if (contactTags != null) + { + _context.ContactTagMappings.RemoveRange(contactTags); + } + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); + contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + + ContactVM contactVM = new ContactVM(); + List phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + List emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + List tagVMs = new List(); + foreach (var contactTagMapping in contactTags) + { + ContactTagVM tagVM = new ContactTagVM(); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); + tagVMs.Add(tagVM); + } + + + contactVM = contact.ToContactVMFromContact(); + contactVM.ContactPhones = phoneVMs; + contactVM.ContactEmails = emailVMs; + contactVM.Tags = tagVMs; + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } } } -- 2.43.0 From a5c472b52e9b24b0202ec391d0b304c8d4b9f08e Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 413/469] added api to get list of contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 0aaa8da..79867d3 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,4 +1,5 @@ -using Marco.Pms.DataAccess.Data; +using System.Linq; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Employees; -- 2.43.0 From 9921683fa644f19565ef8ab6c79138b17cc80b1a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 19:26:55 +0530 Subject: [PATCH 414/469] Added an API to Get a list of buckets Assigned to that employee --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 962ac96..fd23733 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2455,5 +2455,27 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + + // -------------------------------- Bucket -------------------------------- + + public async Task> GetBucketList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); + + List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + + List bucketVMs = new List(); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + } } } -- 2.43.0 From de8ef72caea242a575c0bb2916a6475705f0eb94 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:30:29 +0530 Subject: [PATCH 415/469] Added an API to create a contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 79867d3..0aaa8da 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Employees; -- 2.43.0 From 3b09a5f625446efed4d7f4aad7c7cede22ea8ba9 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 22:23:08 +0530 Subject: [PATCH 416/469] Added an API to create bucket --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index fd23733..e51e9c8 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2477,5 +2477,42 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } + + public async Task> CreateBucket(CreateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null) + { + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); + if (existingBucket != null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); + } + Bucket bucket = new Bucket + { + Name = bucketDto.Name, + Description = bucketDto.Description, + TenantId = tenantId + }; + _context.Buckets.Add(bucket); + + EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping + { + EmployeeId = LoggedInEmployee.Id, + BucketId = bucket.Id + }; + + _context.EmployeeBucketMappings.Add(employeeBucket); + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } } } -- 2.43.0 From 88233d943521aa4e9e13f416daf27dfaf93ee83c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Fri, 16 May 2025 15:13:29 +0530 Subject: [PATCH 417/469] When checking in exsiting tag change Id from mapping Id to Tag ID --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index e51e9c8..aeb7932 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2399,7 +2399,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From 93997c16a25abccd8796720cce7ed14c8ae593b2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 418/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 1 - .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 388 --- 7 files changed, 3141 insertions(+), 390 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 1cedb09..c7918dc 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 12951b9..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -29,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..b368b47 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -58,6 +58,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index aeb7932..1ea8b6a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2126,393 +2126,5 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> CreateContact(CreateContactDto createContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (createContact != null) - { - List phones = new List(); - List emails = new List(); - List contactBucketMappings = new List(); - List contactTagMappings = new List(); - - Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); - - _context.Contacts.Add(contact); - await _context.SaveChangesAsync(); - _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); - - var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); - var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - if (createContact.ContactPhones != null) - { - - foreach (var contactPhone in createContact.ContactPhones) - { - ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); - phones.Add(phone); - } - _context.ContactsPhones.AddRange(phones); - _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.ContactEmails != null) - { - - foreach (var contactEmail in createContact.ContactEmails) - { - ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); - emails.Add(email); - } - _context.ContactsEmails.AddRange(emails); - _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.BucketIds != null) - { - foreach (var bucket in createContact.BucketIds) - { - if (buckets.Contains(bucket)) - { - ContactBucketMapping bucketMapping = new ContactBucketMapping - { - BucketId = bucket, - ContactId = contact.Id - }; - contactBucketMappings.Add(bucketMapping); - } - } - _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); - } - if (createContact.Tags != null) - { - foreach (var tag in createContact.Tags) - { - if (tag.Id != null && tags.Where(t => t.Id == tag.Id) != null) - { - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagtId = tag.Id != null ? tag.Id.Value : Guid.Empty, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) - { - var newtag = new ContactTagMaster - { - Name = tag.Name - }; - _context.ContactTagMasters.Add(newtag); - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagtId = newtag.Id, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - } - _context.ContactTagMappings.AddRange(contactTagMappings); - } - await _context.SaveChangesAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTagMappings) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - - return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContact != null) - { - if (updateContact.Id != id) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); - } - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contact == null) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); - - List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var phoneIds = phones.Select(p => p.Id).ToList(); - List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var emailIds = emails.Select(p => p.Id).ToList(); - - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); - - List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - - if (updateContact.ContactPhones != null) - { - var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); - foreach (var phoneDto in updateContact.ContactPhones) - { - var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); - if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Update(phone); - } - else - { - _context.ContactsPhones.Add(phone); - } - } - foreach (var phone in phones) - { - - if (!updatedPhoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Remove(phone); - } - } - } - else if (phones != null) - { - _context.ContactsPhones.RemoveRange(phones); - } - - if (updateContact.ContactEmails != null) - { - var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); - - foreach (var emailDto in updateContact.ContactEmails) - { - var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); - if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) - { - _context.ContactsEmails.Update(email); - } - else - { - _context.ContactsEmails.Add(email); - } - } - foreach (var email in emails) - { - - if (!updateEmailIds.Contains(email.Id)) - { - _context.ContactsEmails.Remove(email); - } - } - } - else if (emails != null) - { - _context.ContactsEmails.RemoveRange(emails); - } - - if (updateContact.BucketIds != null) - { - foreach (var bucketId in updateContact.BucketIds) - { - if (!bucketIds.Contains(bucketId)) - { - _context.ContactBucketMappings.Add(new ContactBucketMapping - { - BucketId = bucketId, - ContactId = contact.Id - }); - } - } - foreach (var bucketMapping in contactBuckets) - { - if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) - { - _context.ContactBucketMappings.Remove(bucketMapping); - } - } - } - else if (contactBuckets != null) - { - _context.ContactBucketMappings.RemoveRange(contactBuckets); - } - - if (updateContact.Tags != null) - { - var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); - foreach (var tag in updateContact.Tags) - { - if (tag.Id != null && !tagIds.Contains(tag.Id.Value)) - { - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagtId = tag.Id.Value - }); - } - else if (tag.Id == null || tag.Id == Guid.Empty) - { - ContactTagMaster contactTag = new ContactTagMaster - { - Name = tag.Name, - Description = "" - }; - _context.ContactTagMasters.Add(contactTag); - - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagtId = contactTag.Id - }); - } - } - foreach (var contactTag in contactTags) - { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) - { - _context.ContactTagMappings.Remove(contactTag); - } - } - } - else if (contactTags != null) - { - _context.ContactTagMappings.RemoveRange(contactTags); - } - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contact.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - - phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTags) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - - // -------------------------------- Bucket -------------------------------- - - public async Task> GetBucketList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - - List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); - - List bucketVMs = new List(); - foreach (var bucket in bucketList) - { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); - } - _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); - } - - public async Task> CreateBucket(CreateBucketDto bucketDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (bucketDto != null) - { - var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); - if (existingBucket != null) - { - _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); - } - Bucket bucket = new Bucket - { - Name = bucketDto.Name, - Description = bucketDto.Description, - TenantId = tenantId - }; - _context.Buckets.Add(bucket); - - EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping - { - EmployeeId = LoggedInEmployee.Id, - BucketId = bucket.Id - }; - - _context.EmployeeBucketMappings.Add(employeeBucket); - await _context.SaveChangesAsync(); - - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } } } -- 2.43.0 From eb897af87f466e3ef8f511eda5933c97ecaf7927 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 419/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 77 +- 12 files changed, 20 insertions(+), 3285 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index c7918dc..1cedb09 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 2f999d2..0430289 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,6 +390,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -545,32 +548,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2701,33 +2678,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..8197c94 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index b368b47..a901e38 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -58,24 +58,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 1ea8b6a..d7564f1 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1370,19 +1370,14 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -1400,10 +1395,9 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - if (emails != null && emails.Count > 0) + + if (emails != null) { foreach (var email in emails) { @@ -1413,7 +1407,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -1423,7 +1417,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -1436,17 +1430,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -1573,8 +1559,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -1597,7 +1581,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -1613,29 +1596,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -1653,8 +1615,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -1665,20 +1626,12 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -1704,8 +1657,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -1884,8 +1835,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); @@ -1898,7 +1848,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagtId)) { _context.ContactTagMappings.Remove(contactTag); } @@ -1921,10 +1871,6 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -1953,9 +1899,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From 1e70f2bffc3b8db8def32ae0e5ce26e1544129be Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 420/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 +++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 77 ++++++++++++++++--- 8 files changed, 145 insertions(+), 20 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 0430289..2f999d2 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,9 +390,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -548,6 +545,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2678,6 +2701,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 8197c94..2807e9a 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d7564f1..1ea8b6a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1370,14 +1370,19 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -1395,9 +1400,10 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - if (emails != null) + if (emails != null && emails.Count > 0) { foreach (var email in emails) { @@ -1407,7 +1413,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -1417,7 +1423,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -1430,9 +1436,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -1559,6 +1573,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -1581,6 +1597,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -1596,8 +1613,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -1615,7 +1653,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -1626,12 +1665,20 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); + + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); + var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); + List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); foreach (var phone in phones) { ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); @@ -1657,6 +1704,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -1835,7 +1884,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); @@ -1848,7 +1898,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.ContactTagtId)) + if (!updatedTagIds.Contains(contactTag.Id)) { _context.ContactTagMappings.Remove(contactTag); } @@ -1871,6 +1921,10 @@ namespace Marco.Pms.Services.Helpers phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); + contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); + tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); List phoneVMs = new List(); @@ -1899,6 +1953,9 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); } -- 2.43.0 From b3ceecaf9e27152132fd96c9593e9c96d99a7923 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:41:02 +0530 Subject: [PATCH 421/469] properly mapped the updated Dto to contact table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 1ea8b6a..f254429 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1915,7 +1915,19 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException dbEx) + { + + return ApiResponse.ErrorResponse("User Send empty Payload", new + { + message = dbEx.Message, + innerexcption = dbEx.InnerException.Message + }, 400); + } contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 60acd104c128f909e3b5a7adc5599464420bf506 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 422/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index f254429..1ea8b6a 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1915,19 +1915,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 64aaf325bdcade66f44a855b27785701f18056e7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:24:01 +0530 Subject: [PATCH 423/469] Added an API to get contact category by its size --- Marco.Pms.Services/Helpers/MasterHelper.cs | 49 ---------------------- 1 file changed, 49 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 0aaa8da..55883f6 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,55 +144,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } - public async Task> DeleteContactCategory(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - ContactCategoryMaster? contactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contactCategory != null) - { - List? existingContacts = await _context.Contacts.AsNoTracking().Where(c => c.ContactCategoryId == contactCategory.Id).ToListAsync(); - if (existingContacts.Count > 0) - { - List? contacts = new List(); - foreach (var contact in existingContacts) - { - contact.ContactCategoryId = null; - contacts.Add(contact); - } - _context.Contacts.UpdateRange(contacts); - } - _context.ContactCategoryMasters.Remove(contactCategory); - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted contact category {ContactCategoryId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); - } - // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From d62725cb38408b2135767067b1e2d96dfc7ac834 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 424/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 1ea8b6a..8afd1d9 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2067,6 +2067,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From eb096685d5c222baff8de8426f14d1b6e743bc95 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 425/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 8afd1d9..dac3463 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2104,6 +2104,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 928886ac721f0487a85192e98df691d444161990 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 10:57:17 +0530 Subject: [PATCH 426/469] Corrected the typo of ContactTagtId to ContactTagId --- ...14103249_Added_Directory_Related_Tables.cs | 3 +-- .../Directory/ContactTagMapping.cs | 2 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 26 +++++++++---------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs index 3dc4b68..7ef6da4 100644 --- a/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs +++ b/Marco.Pms.DataAccess/Migrations/20250514103249_Added_Directory_Related_Tables.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs index a3d7e9e..91c2835 100644 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -5,7 +5,7 @@ public Guid Id { get; set; } public Guid ContactId { get; set; } public Contact? Contact { get; set; } - public Guid ContactTagtId { get; set; } + public Guid ContactTagId { get; set; } public ContactTagMaster? ContactTag { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index dac3463..0bf4b39 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1383,7 +1383,7 @@ namespace Marco.Pms.Services.Helpers var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List TagIds = Tags.Select(t => t.ContactTagtId).ToList(); + List TagIds = Tags.Select(t => t.ContactTagId).ToList(); var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); @@ -1428,7 +1428,7 @@ namespace Marco.Pms.Services.Helpers foreach (var tagMapping in tagMappingss) { ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagtId); + var tag = TagList.Find(t => t.Id == tagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); conatctTagVms.Add(tagVM); @@ -1486,7 +1486,7 @@ namespace Marco.Pms.Services.Helpers List tagMasters = new List(); if (tags.Count > 0) { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagIds = tags.Select(ct => ct.ContactTagId).ToList(); tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); } @@ -1527,7 +1527,7 @@ namespace Marco.Pms.Services.Helpers { foreach (var contactTag in contactTags) { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagId); if (tagMaster != null) { ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); @@ -1646,7 +1646,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) @@ -1659,7 +1659,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping { - ContactTagtId = newtag.Id, + ContactTagId = newtag.Id, ContactId = contact.Id }; contactTagMappings.Add(tagMapping); @@ -1675,7 +1675,7 @@ namespace Marco.Pms.Services.Helpers List phoneVMs = new List(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagtId).ToList(); + var tagIds = contactTagMappings.Select(t => t.ContactTagId).ToList(); tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); @@ -1694,7 +1694,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTagMappings) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } @@ -1743,7 +1743,7 @@ namespace Marco.Pms.Services.Helpers var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); @@ -1876,7 +1876,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = tag.Id ?? existingTag.Id + ContactTagId = tag.Id ?? existingTag.Id }); } else if (tag.Id == null || tag.Id == Guid.Empty) @@ -1892,7 +1892,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactTagMappings.Add(new ContactTagMapping { ContactId = contact.Id, - ContactTagtId = contactTag.Id + ContactTagId = contactTag.Id }); } } @@ -1923,7 +1923,7 @@ namespace Marco.Pms.Services.Helpers contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagtId).Distinct().ToList(); + tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); ContactVM contactVM = new ContactVM(); @@ -1943,7 +1943,7 @@ namespace Marco.Pms.Services.Helpers foreach (var contactTagMapping in contactTags) { ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagtId); + var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); tagVMs.Add(tagVM); } -- 2.43.0 From 7fd3c7b0b3bc7f447f946545fac58ef8f1f15579 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 19 May 2025 13:18:32 +0530 Subject: [PATCH 427/469] Changed tag validation --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 0bf4b39..00dc520 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1750,7 +1750,8 @@ namespace Marco.Pms.Services.Helpers var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); + List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); + var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); if (updateContact.ContactPhones != null) { @@ -1870,7 +1871,10 @@ namespace Marco.Pms.Services.Helpers var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); foreach (var tag in updateContact.Tags) { - if (tagNames.Contains(tag.Name.ToLower())) + var namecheck = tagNames.Contains(tag.Name.ToLower()); + var idCheck = (!tagIds.Contains(tag.Id ?? Guid.Empty)); + var test = namecheck && idCheck; + if (test) { ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); _context.ContactTagMappings.Add(new ContactTagMapping @@ -1898,7 +1902,7 @@ namespace Marco.Pms.Services.Helpers } foreach (var contactTag in contactTags) { - if (!updatedTagIds.Contains(contactTag.Id)) + if (!updatedTagIds.Contains(contactTag.ContactTagId)) { _context.ContactTagMappings.Remove(contactTag); } -- 2.43.0 From f93caa799461f1a5f4b3288579473edad9929970 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 20 May 2025 09:46:03 +0530 Subject: [PATCH 428/469] Created an API to get contact profile by its Id --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 18 ++- .../Controllers/DirectoryController.cs | 14 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 119 +++++++++++++++++- 3 files changed, 148 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2807e9a..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -51,6 +51,20 @@ namespace Marco.Pms.Model.Mapper Address = contact.Address ?? string.Empty }; } + public static ContactProfileVM ToContactProfileVMFromContact(this Contact contact) + { + return new ContactProfileVM + { + Id = contact.Id, + Name = contact.Name, + ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty, + CreatedAt = contact.CreatedAt, + CreatedBy = contact.CreatedBy != null ? contact.CreatedBy.ToBasicEmployeeVMFromEmployee() : null + }; + } //Contact Phone Mapper public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) @@ -207,7 +221,9 @@ namespace Marco.Pms.Model.Mapper { Id = note.Id, Note = note.Note, - ContactId = note.ContactId + ContactId = note.ContactId, + CreatedAt = note.CreatedAt, + CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null }; } } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index a901e38..12317d3 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -99,6 +99,20 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("profile/{id}")] + public async Task GetContactProfile(Guid id) + { + var response = await _directoryHelper.GetContactProfile(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 00dc520..d58b105 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1552,7 +1552,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); } - public async Task> CreateContact(CreateContactDto createContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -1966,6 +1965,121 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> GetContactProfile(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.Include(c => c.ContactCategory).Include(c => c.CreatedBy).FirstOrDefaultAsync(c => c.Id == id && c.IsActive); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + ContactProfileVM contactVM = contact.ToContactProfileVMFromContact(); + DirectoryUpdateLog? updateLog = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => l.RefereanceId == contact.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefaultAsync(); + if (updateLog != null) + { + contactVM.UpdatedAt = updateLog.UpdateAt; + contactVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + + List? phones = await _context.ContactsPhones.Where(p => p.ContactId == contact.Id).ToListAsync(); + if (phones.Any()) + { + List? phoneVMs = new List(); + foreach (var phone in phones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + contactVM.ContactPhones = phoneVMs; + } + + List? emails = await _context.ContactsEmails.Where(e => e.ContactId == contact.Id).ToListAsync(); + if (emails.Any()) + { + List? emailVMs = new List(); + foreach (var email in emails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + contactVM.ContactEmails = emailVMs; + } + + List? contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); + if (contactProjects.Any()) + { + List projectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + List? projects = await _context.Projects.Where(p => projectIds.Contains(p.Id) && p.TenantId == tenantId).ToListAsync(); + List? projectVMs = new List(); + foreach (var project in projects) + { + BasicProjectVM projectVM = new BasicProjectVM + { + Id = project.Id, + Name = project.Name + }; + projectVMs.Add(projectVM); + } + contactVM.Projects = projectVMs; + } + List? contactBuckets = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + if (contactBuckets.Any() && employeeBuckets.Any()) + { + List contactBucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); + List employeeBucketIds = employeeBuckets.Select(eb => eb.BucketId).ToList(); + List? buckets = await _context.Buckets.Where(b => contactBucketIds.Contains(b.Id) && employeeBucketIds.Contains(b.Id)).ToListAsync(); + List? bucketVMs = new List(); + foreach (var bucket in buckets) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } + contactVM.Buckets = bucketVMs; + } + List? contactTags = await _context.ContactTagMappings.Where(ct => ct.ContactId == contact.Id).ToListAsync(); + if (contactTags.Any()) + { + List tagIds = contactTags.Select(ct => ct.ContactTagId).ToList(); + List tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + List tagVMs = new List(); + foreach (var tagMaster in tagMasters) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + contactVM.Tags = tagVMs; + } + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + if (notes.Any()) + { + List? noteIds = notes.Select(n => n.Id).ToList(); + List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.Id)).OrderByDescending(l => l.UpdateAt).ToListAsync(); + List? noteVMs = new List(); + foreach (var note in notes) + { + DirectoryUpdateLog? noteUpdateLog = noteUpdateLogs.Where(n => n.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + if (noteUpdateLog != null) + { + noteVM.UpdatedAt = noteUpdateLog.UpdateAt; + noteVM.UpdatedBy = noteUpdateLog.Employee != null ? noteUpdateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + noteVMs.Add(noteVM); + } + contactVM.Notes = noteVMs; + } + _logger.LogInfo("Employee ID {EmployeeId} fetched profile of contact {COntactId}", LoggedInEmployee.Id, contact.Id); + return ApiResponse.SuccessResponse(contactVM, "Contact profile fetched successfully"); + + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- @@ -2034,7 +2148,8 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - + noteVM.UpdatedAt = DateTime.UtcNow; + noteVM.UpdatedBy = LoggedInEmployee.ToBasicEmployeeVMFromEmployee(); _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); -- 2.43.0 From aaacd6be9185590ef2e2bd77c350b14eb780b2d2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 10:28:17 +0530 Subject: [PATCH 429/469] Implemented an API to retrieve a list of organizations provided in the contacts. --- Marco.Pms.Services/Controllers/DirectoryController.cs | 7 +++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 12317d3..8f2cb5c 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -113,6 +113,13 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("organization")] + public async Task GetOrganizationList() + { + var response = await _directoryHelper.GetOrganizationList(); + return Ok(response); + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d58b105..2f8106f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2080,6 +2080,15 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); } + public async Task> GetOrganizationList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var organizationList = await _context.Contacts.Where(c => c.TenantId == tenantId).Select(c => c.Organization).Distinct().ToListAsync(); + _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); + return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From 66c167f02725aa287ca60a4d06060cb51f5bde10 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Tue, 20 May 2025 10:00:57 +0530 Subject: [PATCH 430/469] created api for contact Tag Update --- Marco.Pms.Services/Controllers/MasterController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 3512081..bbed781 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,6 +1,8 @@ using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; @@ -638,8 +640,7 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - _logger.LogError("User sent empyt payload"); - return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); + } [HttpDelete("work-category/{id}")] -- 2.43.0 From 5464ee6200dfcd17ca20c5e14487557bd0480cef Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 17:29:20 +0530 Subject: [PATCH 431/469] Implemented an API to suspend a Contact --- .../Controllers/DirectoryController.cs | 22 +++++++++++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 8f2cb5c..843aacb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -107,6 +107,10 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 404) + { + return NotFound(response); + } else { return BadRequest(response); @@ -120,6 +124,24 @@ namespace Marco.Pms.Services.Controllers return Ok(response); } + [HttpDelete("{id}")] + public async Task DeleteContact(Guid id) + { + var response = await _directoryHelper.DeleteContact(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } + // -------------------------------- Contact Notes -------------------------------- [HttpPost("note")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 2f8106f..66efbeb 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2089,6 +2089,26 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } + public async Task> DeleteContact(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); + if (contact == null) + { + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + contact.IsActive = false; + await _context.SaveChangesAsync(); + _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); + } // -------------------------------- Contact Notes -------------------------------- -- 2.43.0 From 8f1c1489e5b155bf58c760490383a9e5b9021919 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 21 May 2025 13:05:08 +0000 Subject: [PATCH 432/469] Update Marco.Pms.Services/Helpers/DirectoryHelper.cs Added entrie to DirectoryUpdateLog Table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 66efbeb..2299268 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2102,6 +2102,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } contact.IsActive = false; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = contact.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); -- 2.43.0 From e407c96bdaebcd843691de90ceb9a72ac44ce1d4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 17:26:51 +0530 Subject: [PATCH 433/469] Implemented filtering functionality for Get Contact List API --- .../Controllers/DirectoryController.cs | 4 +- .../Controllers/MasterController.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 41 +++++++++++++++++-- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 843aacb..2e6db54 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList() + public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(); + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); if (response.StatusCode == 200) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index bbed781..99dc311 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -640,7 +640,8 @@ namespace Marco.Pms.Services.Controllers _logger.LogError("Work category master {WorkCategoryId} not found in database", workCategoryMasterDto.Id ?? Guid.Empty); return NotFound(ApiResponse.ErrorResponse("Work category master not found", "Work category master not found", 404)); } - + _logger.LogError("User sent empyt payload"); + return BadRequest(ApiResponse.ErrorResponse("User sent Empty payload", "User sent Empty payload", 400)); } [HttpDelete("work-category/{id}")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 2299268..2dfdfd6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1366,17 +1366,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts() + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - + if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) + { + bucketIds = filterDto.BucketIds; + } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); - var contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive).ToListAsync(); + List contacts = new List(); + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) + { + var categoryIds = filterDto.CategoryIds; + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && categoryIds.Contains(c.ContactCategoryId ?? Guid.Empty) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } + else + { + contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); + } var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); @@ -1387,6 +1399,19 @@ namespace Marco.Pms.Services.Helpers var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); + if (search != null && search != string.Empty) + { + List filteredContactIds = new List(); + phoneNo = phoneNo.Where(p => Compare(p.PhoneNumber, search)).ToList(); + filteredContactIds = phoneNo.Select(p => p.ContactId).ToList(); + + Emails = Emails.Where(e => Compare(e.EmailAddress, search)).ToList(); + filteredContactIds.AddRange(Emails.Select(e => e.ContactId).ToList()); + filteredContactIds = filteredContactIds.Distinct().ToList(); + + contacts = contacts.Where(c => Compare(c.Name, search) || Compare(c.Organization, search) || filteredContactIds.Contains(c.Id)).ToList(); + } + List list = new List(); foreach (var contact in contacts) @@ -1403,6 +1428,7 @@ namespace Marco.Pms.Services.Helpers var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); + if (emails != null && emails.Count > 0) { foreach (var email in emails) @@ -2342,5 +2368,14 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + private bool Compare(string sentence, string search) + { + sentence = sentence.Trim().ToLower(); + search = search.Trim().ToLower(); + + // Check for exact substring + bool result = sentence.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; + return result; + } } } -- 2.43.0 From 0427b4196185dcf3e6baabfd07dbdf02b68fba08 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 22:10:51 +0530 Subject: [PATCH 434/469] Accepting List of buckets and categories Ids rather than as payload --- .../Controllers/DirectoryController.cs | 13 ++++++++---- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 20 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 2e6db54..ba05625 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -25,9 +25,14 @@ namespace Marco.Pms.Services.Controllers } [HttpGet] - public async Task GetContactList([FromQuery] string? search, [FromBody] ContactFilterDto? filterDto, [FromQuery] bool active = true) + public async Task GetContactList([FromQuery] string? search, [FromQuery] List? bucketIds, [FromQuery] List? categoryIds, [FromQuery] Guid? projectId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetListOfContacts(search, active, filterDto); + ContactFilterDto filterDto = new ContactFilterDto + { + BucketIds = bucketIds, + CategoryIds = categoryIds + }; + var response = await _directoryHelper.GetListOfContacts(search, active, filterDto, projectId); if (response.StatusCode == 200) @@ -164,9 +169,9 @@ namespace Marco.Pms.Services.Controllers } [HttpGet("note/{ContactId}")] - public async Task GetNoteListByContactId(Guid contactId) + public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { - var response = await _directoryHelper.GetNoteListByContactId(contactId); + var response = await _directoryHelper.GetNoteListByContactId(contactId, active); if (response.StatusCode == 200) { return Ok(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 2dfdfd6..58cef51 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1366,20 +1366,29 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto) + public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto, Guid? projectId) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { - bucketIds = filterDto.BucketIds; + filterbucketIds = filterDto.BucketIds; } List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Select(cb => cb.ContactId).ToList(); + List contactIds = contactBuckets.Where(b => filterbucketIds.Contains(b.BucketId)).Select(cb => cb.ContactId).ToList(); List contacts = new List(); + var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + + if (projectId != null && projectId != Guid.Empty) + { + contactProjects = contactProjects.Where(p => p.ProjectId == projectId).ToList(); + contactIds = contactProjects.Select(p => p.ContactId).Distinct().ToList(); + } + if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) { var categoryIds = filterDto.CategoryIds; @@ -1393,7 +1402,6 @@ namespace Marco.Pms.Services.Helpers var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); List TagIds = Tags.Select(t => t.ContactTagId).ToList(); @@ -2146,14 +2154,14 @@ namespace Marco.Pms.Services.Helpers // -------------------------------- Contact Notes -------------------------------- - public async Task> GetNoteListByContactId(Guid id) + public async Task> GetNoteListByContactId(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); + List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { -- 2.43.0 From 30cd9d3a57bca82ce5ca5d98368642e915b49752 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 19:48:45 +0530 Subject: [PATCH 435/469] Implemented an API to update Buckets for grouping contacts. --- .../Controllers/DirectoryController.cs | 18 +++++++++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 31 ++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index ba05625..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -247,5 +247,23 @@ namespace Marco.Pms.Services.Controllers } } + + [HttpPut("bucket/{id}")] + public async Task UpdateBucket(Guid id, [FromBody] UpdateBucketDto bucketDto) + { + var response = await _directoryHelper.UpdateBucket(id, bucketDto); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 58cef51..4d6cddd 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2338,7 +2338,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); } - public async Task> CreateBucket(CreateBucketDto bucketDto) { Guid tenantId = _userHelper.GetTenantId(); @@ -2375,7 +2374,37 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> UpdateBucket(Guid id, UpdateBucketDto bucketDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (bucketDto != null && id == bucketDto.Id) + { + var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + bucket.Name = bucketDto.Name ?? ""; + bucket.Description = bucketDto.Description ?? ""; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketDto.Id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 69d27c7471c179dbcb133ce9f92c98300e8260e8 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 22 May 2025 20:27:13 +0530 Subject: [PATCH 436/469] Implemented an API to update Contact Category Master --- Marco.Pms.Services/Controllers/MasterController.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index 99dc311..3512081 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,8 +1,6 @@ using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Directory; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; -- 2.43.0 From 9ceba92447c6603f805eae98718f539885f444ea Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 24 May 2025 15:45:43 +0530 Subject: [PATCH 437/469] Add Directory Management Feature with Permission Handling --- Marco.Pms.Model/Directory/Bucket.cs | 6 +++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs index 028b428..0d382c5 100644 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -1,4 +1,5 @@ -using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; namespace Marco.Pms.Model.Directory { @@ -6,6 +7,9 @@ namespace Marco.Pms.Model.Directory { public Guid Id { get; set; } public string Name { get; set; } = string.Empty; + public Guid CreatedByID { get; set; } + public Employee? CreatedBy { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4d6cddd..841a4e3 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2354,6 +2354,8 @@ namespace Marco.Pms.Services.Helpers { Name = bucketDto.Name, Description = bucketDto.Description, + CreatedAt = DateTime.UtcNow, + CreatedByID = LoggedInEmployee.Id, TenantId = tenantId }; _context.Buckets.Add(bucket); -- 2.43.0 From d294bcef44a60805c61278251af9d13bde092fb7 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 15 May 2025 14:59:30 +0530 Subject: [PATCH 438/469] Created an endpoint to fetch list of all contact category in that tenant --- Marco.Pms.Services/Helpers/MasterHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 55883f6..df9cee1 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -144,6 +144,22 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } + public async Task> GetContactCategoriesList() + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); + List contactCategories = new List(); + foreach (var category in categoryList) + { + ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); + contactCategories.Add(categoryVM); + } + _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); + } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From ddc6f9e39399ae4bad112792214d765ab10a5f6a Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 15 May 2025 18:52:43 +0530 Subject: [PATCH 439/469] added api to get list of contact tag --- Marco.Pms.Services/Helpers/MasterHelper.cs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index df9cee1..03f6d60 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -143,23 +143,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } - - public async Task> GetContactCategoriesList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync(); - List contactCategories = new List(); - foreach (var category in categoryList) - { - ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster(); - contactCategories.Add(categoryVM); - } - _logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200); - } - // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 45cdbd91c91530481889cb174b41954acb7fad24 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 440/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- .../Controllers/DirectoryController.cs | 18 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 96 + 6 files changed, 3237 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 1cedb09..c7918dc 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..d9f9a66 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,6 +63,24 @@ namespace Marco.Pms.Services.Controllers } } + [HttpGet("contact-bucket/{bucketId}")] + public async Task GetContactsListByBucketId(Guid bucketId) + { + var response = await _directoryHelper.GetContactsListByBucketId(bucketId); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } + [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 841a4e3..35c686d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -181,6 +181,102 @@ namespace Marco.Pms.Services.Helpers } + public async Task> GetContactsListByBucketId(Guid id) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (id != Guid.Empty) + { + EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + if (employeeBucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); + } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); + List contactVMs = new List(); + if (contactBucket.Count > 0) + { + var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); + List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); + List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); + List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); + + List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); + List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); + + List tagIds = new List(); + List tagMasters = new List(); + if (tags.Count > 0) + { + tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); + tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); + } + + if (contacts.Count > 0) + { + + + foreach (var contact in contacts) + { + List? emailVMs = new List(); + List? phoneVMs = new List(); + List? tagVMs = new List(); + + List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); + List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); + + List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); + List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); + List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); + + if (contactPhones.Count > 0) + { + foreach (var phone in contactPhones) + { + ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); + phoneVMs.Add(phoneVM); + } + } + if (contactEmails.Count > 0) + { + foreach (var email in contactEmails) + { + ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); + emailVMs.Add(emailVM); + } + } + if (contactTags.Count > 0) + { + foreach (var contactTag in contactTags) + { + ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); + if (tagMaster != null) + { + ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); + tagVMs.Add(tagVM); + } + } + } + ContactVM contactVM = contact.ToContactVMFromContact(); + contactVM.ContactEmails = emailVMs; + contactVM.ContactPhones = phoneVMs; + contactVM.Tags = tagVMs; + contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); + contactVMs.Add(contactVM); + } + } + + } + _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); + return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); + } + _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); + } + public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); -- 2.43.0 From 17398dafa6b1c2a34b65735d6b4f66670f614998 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 441/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - .../ApplicationDbContextModelSnapshot.cs | 56 +- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 - .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 + .../ViewModels/Directory/ContactVM.cs | 3 +- .../Controllers/DirectoryController.cs | 18 - Marco.Pms.Services/Helpers/DirectoryHelper.cs | 153 +- 12 files changed, 17 insertions(+), 3364 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs delete mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index c7918dc..1cedb09 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,7 +78,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 2f999d2..0430289 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,6 +390,9 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("ProjectId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); @@ -545,32 +548,6 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2701,33 +2678,6 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs deleted file mode 100644 index 46d0482..0000000 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; - -namespace Marco.Pms.Model.Directory -{ - public class ContactProjectMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ProjectId { get; set; } - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid ContactId { get; set; } - [ValidateNever] - [ForeignKey("ContactId")] - public Contact? Contact { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..cadd7e2 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..ccf5345 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..358bf54 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -29,6 +30,7 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -44,6 +46,7 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..b1abb3b 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d9f9a66..fcd82a7 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -63,24 +63,6 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("contact-bucket/{bucketId}")] - public async Task GetContactsListByBucketId(Guid bucketId) - { - var response = await _directoryHelper.GetContactsListByBucketId(bucketId); - if (response.StatusCode == 200) - { - return Ok(response); - } - else if (response.StatusCode == 401) - { - return Unauthorized(response); - } - else - { - return BadRequest(response); - } - } - [HttpPost] public async Task CreateContact([FromBody] CreateContactDto createContact) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 35c686d..145b73e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -122,8 +122,6 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); if (emails != null && emails.Count > 0) @@ -136,7 +134,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null && phones.Count > 0) + if (phones != null) { foreach (var phone in phones) { @@ -146,7 +144,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null && tagMappingss.Count > 0) + if (tagMappingss != null) { foreach (var tagMapping in tagMappingss) { @@ -159,17 +157,9 @@ namespace Marco.Pms.Services.Helpers } } + + contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -181,102 +171,6 @@ namespace Marco.Pms.Services.Helpers } - public async Task> GetContactsListByBucketId(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); - if (employeeBucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); - } - List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); - List contactVMs = new List(); - if (contactBucket.Count > 0) - { - var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); - List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); - List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); - - List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); - List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - - List tagIds = new List(); - List tagMasters = new List(); - if (tags.Count > 0) - { - tagIds = tags.Select(ct => ct.ContactTagtId).ToList(); - tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - } - - if (contacts.Count > 0) - { - - - foreach (var contact in contacts) - { - List? emailVMs = new List(); - List? phoneVMs = new List(); - List? tagVMs = new List(); - - List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); - List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); - - List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); - List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); - List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); - - if (contactPhones.Count > 0) - { - foreach (var phone in contactPhones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - } - if (contactEmails.Count > 0) - { - foreach (var email in contactEmails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - } - if (contactTags.Count > 0) - { - foreach (var contactTag in contactTags) - { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagtId); - if (tagMaster != null) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - } - } - ContactVM contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = emailVMs; - contactVM.ContactPhones = phoneVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - contactVMs.Add(contactVM); - } - } - - } - _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); - } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -417,8 +311,6 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - if (createContact.ContactPhones != null) { @@ -441,7 +333,6 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } - if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -457,29 +348,8 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -1782,8 +1652,7 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name, - TenantId = tenantId + Name = tag.Name }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -1794,9 +1663,7 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); @@ -1833,8 +1700,6 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -1875,9 +1740,6 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); @@ -2017,8 +1879,7 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "", - TenantId = tenantId + Description = "" }; _context.ContactTagMasters.Add(contactTag); -- 2.43.0 From 166d556b6c8bb39f83e87928b9d945395b066d87 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:09:54 +0530 Subject: [PATCH 442/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../ApplicationDbContextModelSnapshot.cs | 56 +++++++++++++++++- Marco.Pms.Model/Directory/Contact.cs | 2 +- .../Directory/ContactProjectMapping.cs | 20 +++++++ .../Dtos/Directory/CreateContactDto.cs | 2 +- .../Dtos/Directory/UpdateContactDto.cs | 2 +- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 - .../ViewModels/Directory/ContactVM.cs | 3 +- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 58 ++++++++++++++++--- 8 files changed, 129 insertions(+), 17 deletions(-) create mode 100644 Marco.Pms.Model/Directory/ContactProjectMapping.cs diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 0430289..2f999d2 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -390,9 +390,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("ProjectId") - .HasColumnType("char(36)"); - b.Property("TenantId") .HasColumnType("char(36)"); @@ -548,6 +545,32 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("ContactsPhones"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.Property("Id") @@ -2678,6 +2701,33 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Contact"); }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => { b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index 87d7698..ecdd622 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + //public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs new file mode 100644 index 0000000..0f965fe --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactProjectMapping : TenantRelation + { + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + [ValidateNever] + [ForeignKey("ProjectId")] + public Project? Project { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index cadd7e2..577f405 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,7 +2,7 @@ { public class CreateContactDto { - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index ccf5345..c648db0 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 358bf54..68ea44e 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -13,7 +13,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { - ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, @@ -30,7 +29,6 @@ namespace Marco.Pms.Model.Mapper return new Contact { Id = updateContactDto.Id, - ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, CreatedAt = contact.CreatedAt, @@ -46,7 +44,6 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, - ProjectId = contact.ProjectId, Name = contact.Name, ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, Description = contact.Description ?? string.Empty, diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index b1abb3b..d394f73 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,11 +5,12 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public Guid? ProjectId { get; set; } + public List? ProjectIds { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } public ContactCategoryVM? ContactCategory { get; set; } + public List? BucketIds { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 145b73e..4fd7bd6 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -88,6 +88,7 @@ namespace Marco.Pms.Services.Helpers + var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); @@ -122,6 +123,8 @@ namespace Marco.Pms.Services.Helpers var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); + var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); + var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); if (emails != null && emails.Count > 0) @@ -134,7 +137,7 @@ namespace Marco.Pms.Services.Helpers } } - if (phones != null) + if (phones != null && phones.Count > 0) { foreach (var phone in phones) { @@ -144,7 +147,7 @@ namespace Marco.Pms.Services.Helpers } } - if (tagMappingss != null) + if (tagMappingss != null && tagMappingss.Count > 0) { foreach (var tagMapping in tagMappingss) { @@ -157,9 +160,17 @@ namespace Marco.Pms.Services.Helpers } } - - contactVM = contact.ToContactVMFromContact(); + + if (projectMapping != null && projectMapping.Count > 0) + { + contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); + } + if (bucketMapping != null && bucketMapping.Count > 0) + { + contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); + } + contactVM.ContactEmails = contactEmailVms; contactVM.ContactPhones = contactPhoneVms; contactVM.Tags = conatctTagVms; @@ -311,6 +322,8 @@ namespace Marco.Pms.Services.Helpers var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); + var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); + if (createContact.ContactPhones != null) { @@ -333,6 +346,7 @@ namespace Marco.Pms.Services.Helpers _context.ContactsEmails.AddRange(emails); _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); } + if (createContact.BucketIds != null) { foreach (var bucket in createContact.BucketIds) @@ -348,8 +362,29 @@ namespace Marco.Pms.Services.Helpers } } _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, LoggedInEmployee.Id); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); } + + if (createContact.ProjectIds != null) + { + List projectMappings = new List(); + foreach (var projectId in createContact.ProjectIds) + { + if (projects.Contains(projectId)) + { + ContactProjectMapping projectMapping = new ContactProjectMapping + { + ProjectId = projectId, + ContactId = contact.Id, + TenantId = tenantId + }; + projectMappings.Add(projectMapping); + } + } + _context.ContactProjectMappings.AddRange(projectMappings); + _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); + } + if (createContact.Tags != null) { foreach (var tag in createContact.Tags) @@ -1652,7 +1687,8 @@ namespace Marco.Pms.Services.Helpers { var newtag = new ContactTagMaster { - Name = tag.Name + Name = tag.Name, + TenantId = tenantId }; _context.ContactTagMasters.Add(newtag); ContactTagMapping tagMapping = new ContactTagMapping @@ -1663,7 +1699,9 @@ namespace Marco.Pms.Services.Helpers contactTagMappings.Add(tagMapping); } } + _context.ContactTagMappings.AddRange(contactTagMappings); + _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); } await _context.SaveChangesAsync(); @@ -1700,6 +1738,8 @@ namespace Marco.Pms.Services.Helpers contactVM.ContactPhones = phoneVMs; contactVM.ContactEmails = emailVMs; contactVM.Tags = tagVMs; + contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); + contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); } @@ -1740,6 +1780,9 @@ namespace Marco.Pms.Services.Helpers var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); + List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); + var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); + List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); @@ -1879,7 +1922,8 @@ namespace Marco.Pms.Services.Helpers ContactTagMaster contactTag = new ContactTagMaster { Name = tag.Name, - Description = "" + Description = "", + TenantId = tenantId }; _context.ContactTagMasters.Add(contactTag); -- 2.43.0 From ec63cde59b498ca9d01867e890776d4360aa5d3a Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 13:31:35 +0530 Subject: [PATCH 443/469] Added functionality to stop recreating tas of same name --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 4fd7bd6..5699b20 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -181,7 +181,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); } - public async Task> GetContactsListByBucketId(Guid id) { Guid tenantId = _userHelper.GetTenantId(); @@ -461,7 +460,6 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) { Guid tenantId = _userHelper.GetTenantId(); @@ -695,19 +693,7 @@ namespace Marco.Pms.Services.Helpers UpdateAt = DateTime.UtcNow }); - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateException dbEx) - { - - return ApiResponse.ErrorResponse("User Send empty Payload", new - { - message = dbEx.Message, - innerexcption = dbEx.InnerException.Message - }, 400); - } + await _context.SaveChangesAsync(); contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); -- 2.43.0 From 84767d41b8217bb2122f06458c7e91f81357290b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 444/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 5699b20..1fbe087 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2304,6 +2304,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 8ca07410b0b34039fed748878bc6cf84b6f1c356 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 445/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 1fbe087..83fd3d3 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2341,6 +2341,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 85adf504188c0115c0f12b2ae6dd6fcd839c5a12 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:52:45 +0530 Subject: [PATCH 446/469] added an API to get list of contacts by bucket id and added project- contact mapping table --- .../Data/ApplicationDbContext.cs | 1 + ...ed_ContactProjectMapping_Table.Designer.cs | 3040 +++++++++++++++++ ...50718_Added_ContactProjectMapping_Table.cs | 81 + .../Directory/ContactProjectMapping.cs | 2 +- 4 files changed, 3123 insertions(+), 1 deletion(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 1cedb09..c7918dc 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -78,6 +78,7 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactTagMappings { get; set; } public DbSet EmployeeBucketMappings { get; set; } public DbSet ContactBucketMappings { get; set; } + public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } public DbSet ContactProjectMappings { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs new file mode 100644 index 0000000..2d8fae9 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs @@ -0,0 +1,3040 @@ +// +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("20250517050718_Added_ContactProjectMapping_Table")] + partial class Added_ContactProjectMapping_Table + { + /// + 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("char(36)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + 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("char(36)"); + + 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") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.Property("ContactTagtId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .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.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.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + 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("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + 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("Document"); + + 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); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .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("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId"); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Roles.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.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs new file mode 100644 index 0000000..2a0b6c5 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_ContactProjectMapping_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Contacts"); + + migrationBuilder.CreateTable( + name: "ContactProjectMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); + table.ForeignKey( + name: "FK_ContactProjectMappings_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactProjectMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ContactId", + table: "ContactProjectMappings", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_ProjectId", + table: "ContactProjectMappings", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactProjectMappings_TenantId", + table: "ContactProjectMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContactProjectMappings"); + + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Contacts", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + } + } +} diff --git a/Marco.Pms.Model/Directory/ContactProjectMapping.cs b/Marco.Pms.Model/Directory/ContactProjectMapping.cs index 0f965fe..46d0482 100644 --- a/Marco.Pms.Model/Directory/ContactProjectMapping.cs +++ b/Marco.Pms.Model/Directory/ContactProjectMapping.cs @@ -17,4 +17,4 @@ namespace Marco.Pms.Model.Directory [ForeignKey("ContactId")] public Contact? Contact { get; set; } } -} \ No newline at end of file +} -- 2.43.0 From 9a1944062249d1f9826866b49d6cbd7b0bd10307 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 11:53:48 +0530 Subject: [PATCH 447/469] Revert "added an API to get list of contacts by bucket id and added project- contact mapping table" This reverts commit 22f777ca87053d2c79db610a27b8d7a5169e57bc. --- .../Data/ApplicationDbContext.cs | 1 - ...ed_ContactProjectMapping_Table.Designer.cs | 3040 ----------------- ...50718_Added_ContactProjectMapping_Table.cs | 81 - 3 files changed, 3122 deletions(-) delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs delete mode 100644 Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index c7918dc..1b76adb 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -80,7 +80,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ContactBucketMappings { get; set; } public DbSet ContactProjectMappings { get; set; } public DbSet DirectoryUpdateLogs { get; set; } - public DbSet ContactProjectMappings { get; set; } public DbSet MailingList { get; set; } public DbSet MailDetails { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs deleted file mode 100644 index 2d8fae9..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.Designer.cs +++ /dev/null @@ -1,3040 +0,0 @@ -// -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("20250517050718_Added_ContactProjectMapping_Table")] - partial class Added_ContactProjectMapping_Table - { - /// - 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("char(36)"); - - b.Property("AssignedBy") - .HasColumnType("char(36)"); - - b.Property("AssignmentDate") - .HasColumnType("datetime(6)"); - - b.Property("CompletedTask") - .HasColumnType("double"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("PlannedTask") - .HasColumnType("double"); - - b.Property("ReportedDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkItemId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedBy"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkItemId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CommentDate") - .HasColumnType("datetime(6)"); - - b.Property("CommentedBy") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentedBy"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("TaskAllocationId"); - - b.HasIndex("TenantId"); - - b.ToTable("TaskMembers"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ApprovedBy") - .HasColumnType("char(36)"); - - b.Property("AttendanceDate") - .HasColumnType("datetime(6)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("InTime") - .HasColumnType("datetime(6)"); - - b.Property("IsApproved") - .HasColumnType("tinyint(1)"); - - b.Property("OutTime") - .HasColumnType("datetime(6)"); - - b.Property("ProjectID") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("Activity") - .HasColumnType("int"); - - b.Property("ActivityTime") - .HasColumnType("datetime(6)"); - - b.Property("AttendanceId") - .HasColumnType("char(36)"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DocumentId") - .HasColumnType("char(36)"); - - b.Property("EmployeeID") - .HasColumnType("char(36)"); - - b.Property("Latitude") - .HasColumnType("longtext"); - - b.Property("Longitude") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UpdatedBy") - .HasColumnType("char(36)"); - - b.Property("UpdatedOn") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceId"); - - b.HasIndex("DocumentId"); - - 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("char(36)"); - - 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") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buckets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("ContactCategoryId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Organization") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactCategoryId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactCategoryMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsEmails"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactNotes"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("IsPrimary") - .HasColumnType("tinyint(1)"); - - b.Property("Label") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.ToTable("ContactsPhones"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactProjectMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactId") - .HasColumnType("char(36)"); - - b.Property("ContactTagId") - .HasColumnType("char(36)"); - - b.Property("ContactTagtId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ContactId"); - - b.HasIndex("ContactTagId"); - - b.ToTable("ContactTagMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ContactTagMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("RefereanceId") - .HasColumnType("char(36)"); - - b.Property("UpdateAt") - .HasColumnType("datetime(6)"); - - b.Property("UpdatedById") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedById"); - - b.ToTable("DirectoryUpdateLogs"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BucketId") - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("BucketId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("EmployeeBucketMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Base64Data") - .HasColumnType("longtext"); - - b.Property("BatchId") - .HasColumnType("char(36)"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("S3Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ThumbS3Key") - .HasColumnType("longtext"); - - b.Property("UploadedAt") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AadharNumber") - .HasColumnType("longtext"); - - b.Property("ApplicationUserId") - .HasColumnType("varchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime(6)"); - - b.Property("CurrentAddress") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("EmergencyContactPerson") - .HasColumnType("longtext"); - - b.Property("EmergencyPhoneNumber") - .HasColumnType("longtext"); - - b.Property("FirstName") - .HasColumnType("longtext"); - - b.Property("Gender") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("JoiningDate") - .HasColumnType("datetime(6)"); - - b.Property("LastName") - .HasColumnType("longtext"); - - b.Property("MiddleName") - .HasColumnType("longtext"); - - b.Property("PanNumber") - .HasColumnType("longtext"); - - b.Property("PermanentAddress") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("Photo") - .HasColumnType("longblob"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("JobRoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Employees"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("RoleId"); - - b.HasIndex("TenantId"); - - b.ToTable("EmployeeRoleMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("time(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("StartTime") - .HasColumnType("time(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkShifts"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsChecked") - .HasColumnType("tinyint(1)"); - - b.Property("IsMandatory") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("ActivityCheckLists"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CheckListId") - .HasColumnType("char(36)"); - - b.Property("TaskAllocationId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("CheckListMappings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("FeatureId") - .HasColumnType("char(36)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .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.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.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ContactName") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DomainName") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OnBoardingDate") - .HasColumnType("datetime(6)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("IndustryId"); - - b.ToTable("Tenants"); - - b.HasData( - new - { - Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), - ContactName = "Admin", - ContactNumber = "123456789", - Description = "", - DomainName = "www.marcobms.org", - IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - IsActive = true, - Name = "MarcoBMS", - OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - OragnizationSize = "100-200" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommentId") - .HasColumnType("char(36)"); - - b.Property("FileId") - .HasColumnType("char(36)"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CommentId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketAttachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthorId") - .HasColumnType("char(36)"); - - b.Property("MessageText") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentMessageId") - .HasColumnType("char(36)"); - - b.Property("SentAt") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("TicketComments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatedAt") - .HasColumnType("datetime(6)"); - - b.Property("CreatedById") - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LinkedActivityId") - .HasColumnType("char(36)"); - - b.Property("LinkedProjectId") - .HasColumnType("char(36)"); - - b.Property("PriorityId") - .HasColumnType("char(36)"); - - b.Property("StatusId") - .HasColumnType("char(36)"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TypeId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("PriorityId"); - - b.HasIndex("StatusId"); - - b.HasIndex("TenantId"); - - b.HasIndex("TypeId"); - - b.ToTable("Tickets"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("TagId") - .HasColumnType("char(36)"); - - b.Property("TicketId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.HasIndex("TicketId"); - - b.ToTable("TicketTags"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTypeMasters"); - - b.HasData( - new - { - Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), - Description = "An identified problem that affects the performance, reliability, or standards of a product or service", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), - Description = "A support service that assists users with technical issues, requests, or inquiries.", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityName") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UnitOfMeasurement") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ActivityMasters"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("ModuleId") - .HasColumnType("char(36)"); - - b.Property("Name") - .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 = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Project" - }, - new - { - Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), - Description = "Manage Infra", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Infra" - }, - new - { - Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), - Description = "Manage Tasks", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Manage Tasks" - }, - new - { - Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), - Description = "Assign and Update Tasks Progress", - IsActive = true, - ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Name = "Assign and Update Tasks Progress" - }, - new - { - Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), - Description = "Manage Employee", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Manage Employee" - }, - new - { - Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), - Description = "Attendance", - IsActive = true, - ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Name = "Attendance" - }, - new - { - Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), - Description = "Global Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Global Masters" - }, - new - { - Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), - Description = "Tenant Masters", - IsActive = true, - ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Name = "Tenant Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Industries"); - - b.HasData( - new - { - Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), - Name = "Information Technology (IT) Services" - }, - new - { - Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), - Name = "Manufacturing & Production" - }, - new - { - Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), - Name = "Energy & Resources" - }, - new - { - Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), - Name = "Finance & Professional Services" - }, - new - { - Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), - Name = "Hospitals and Healthcare Services" - }, - new - { - Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), - Name = "Social Services" - }, - new - { - Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), - Name = "Retail & Consumer Services" - }, - new - { - Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), - Name = "Transportation & Logistics" - }, - new - { - Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), - Name = "Education & Training" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Key") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Modules"); - - b.HasData( - new - { - Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), - Description = "Project Module", - Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", - Name = "Project" - }, - new - { - Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), - Description = "Employee Module", - Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", - Name = "Employee" - }, - new - { - Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), - Description = "Masters Module", - Key = "504ec132-e6a9-422f-8f85-050602cfce05", - Name = "Masters" - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("StatusMasters"); - - b.HasData( - new - { - Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - Status = "Active", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), - Status = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), - Status = "On Hold", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), - Status = "Completed", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Level") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketPriorityMasters"); - - b.HasData( - new - { - Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), - ColorCode = "008000", - IsDefault = true, - Level = 1, - Name = "Low", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), - ColorCode = "FFFF00", - IsDefault = true, - Level = 2, - Name = "Medium", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 3, - Name = "High", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), - ColorCode = "#FFA500", - IsDefault = true, - Level = 4, - Name = "Critical", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), - ColorCode = "#FF0000", - IsDefault = true, - Level = 5, - Name = "Urgent", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketStatusMasters"); - - b.HasData( - new - { - Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), - ColorCode = "#FFCC99", - Description = "This is a newly created issue.", - IsDefault = true, - Name = "New", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), - ColorCode = "#E6FF99", - Description = "Assigned to employee or team of employees", - IsDefault = true, - Name = "Assigned", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), - ColorCode = "#99E6FF", - Description = "These issues are currently in progress", - IsDefault = true, - Name = "In Progress", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), - ColorCode = "#6c757d", - Description = "These issues are currently under review", - IsDefault = true, - Name = "In Review", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), - ColorCode = "#B399FF", - Description = "The following issues are resolved and closed", - IsDefault = true, - Name = "Done", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ColorCode") - .HasColumnType("longtext"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("TicketTagMasters"); - - b.HasData( - new - { - Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), - ColorCode = "#e59866", - IsDefault = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), - ColorCode = "#85c1e9", - IsDefault = true, - Name = "Help Desk", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkCategoryMasters"); - - b.HasData( - new - { - Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), - Description = "Created new task in a professional or creative context", - IsSystem = true, - Name = "Fresh Work", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), - Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", - IsSystem = true, - Name = "Rework", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }, - new - { - Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), - Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", - IsSystem = true, - Name = "Quality Issue", - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Buildings"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BuildingId") - .HasColumnType("char(36)"); - - b.Property("FloorName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("EndDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProjectAddress") - .HasColumnType("longtext"); - - b.Property("ProjectStatusId") - .HasColumnType("char(36)"); - - b.Property("StartDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectStatusId"); - - b.HasIndex("TenantId"); - - b.ToTable("Projects"); - - b.HasData( - new - { - Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), - ContactPerson = "Project 1 Contact Person", - EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - Name = "Project 1", - ProjectAddress = "Project 1 Address", - ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), - StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), - TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") - }); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("EmployeeId") - .HasColumnType("char(36)"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("JobRoleId") - .HasColumnType("char(36)"); - - b.Property("ProjectId") - .HasColumnType("char(36)"); - - b.Property("ReAllocationDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("AreaName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FloorId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("FloorId"); - - b.HasIndex("TenantId"); - - b.ToTable("WorkAreas"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActivityId") - .HasColumnType("char(36)"); - - b.Property("CompletedWork") - .HasColumnType("double"); - - b.Property("PlannedWork") - .HasColumnType("double"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("WorkAreaId") - .HasColumnType("char(36)"); - - b.Property("WorkCategoryId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.HasIndex("WorkCategoryId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("IsSystem") - .HasColumnType("tinyint(1)"); - - b.Property("Role") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("ApplicationRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("JobRoles"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("About") - .HasColumnType("longtext"); - - b.Property("ContactNumber") - .HasColumnType("longtext"); - - b.Property("ContactPerson") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("IndustryId") - .HasColumnType("char(36)"); - - b.Property("OragnizationSize") - .HasColumnType("longtext"); - - b.Property("OrganizatioinName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Inquiries"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("varchar(21)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)"); - - b.Property("IsRootUser") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasDiscriminator().HasValue("ApplicationUser"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("AssignedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Tenant"); - - b.Navigation("WorkItem"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("CommentedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") - .WithMany() - .HasForeignKey("TaskAllocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("TaskAllocation"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") - .WithMany() - .HasForeignKey("EmployeeID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => - { - b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") - .WithMany() - .HasForeignKey("AttendanceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId"); - - 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("Document"); - - 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); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => - { - b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") - .WithMany() - .HasForeignKey("ContactCategoryId"); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactCategory"); - - b.Navigation("CreatedBy"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Createdby"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Contact"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .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("Contact"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") - .WithMany() - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") - .WithMany() - .HasForeignKey("ContactTagId"); - - b.Navigation("Contact"); - - b.Navigation("ContactTag"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => - { - b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") - .WithMany() - .HasForeignKey("BucketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Bucket"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Roles.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.EmployeeRoleMapping", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Roles.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.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.FeaturePermission", b => - { - b.HasOne("Marco.Pms.Model.Master.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.Roles.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.Tenant", b => - { - b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") - .WithMany() - .HasForeignKey("IndustryId"); - - b.Navigation("Industry"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => - { - b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") - .WithMany("Attachments") - .HasForeignKey("CommentId"); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - - b.Navigation("TicketComment"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") - .WithMany() - .HasForeignKey("PriorityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") - .WithMany() - .HasForeignKey("StatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") - .WithMany() - .HasForeignKey("TypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Priority"); - - b.Navigation("Tenant"); - - b.Navigation("TicketStatusMaster"); - - b.Navigation("TicketTypeMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => - { - b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") - .WithMany() - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") - .WithMany() - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tag"); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.HasOne("Marco.Pms.Model.Master.Module", "Module") - .WithMany() - .HasForeignKey("ModuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Module"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.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.Master.WorkCategoryMaster", 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.Master.StatusMaster", "ProjectStatus") - .WithMany() - .HasForeignKey("ProjectStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectStatus"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => - { - b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Projects.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Project"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => - { - b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") - .WithMany() - .HasForeignKey("FloorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Floor"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Master.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.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") - .WithMany() - .HasForeignKey("WorkCategoryId"); - - b.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkCategoryMaster"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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.Forum.TicketComment", b => - { - b.Navigation("Attachments"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => - { - b.Navigation("FeaturePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs b/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs deleted file mode 100644 index 2a0b6c5..0000000 --- a/Marco.Pms.DataAccess/Migrations/20250517050718_Added_ContactProjectMapping_Table.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Marco.Pms.DataAccess.Migrations -{ - /// - public partial class Added_ContactProjectMapping_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectId", - table: "Contacts"); - - migrationBuilder.CreateTable( - name: "ContactProjectMappings", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ContactId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ContactProjectMappings", x => x.Id); - table.ForeignKey( - name: "FK_ContactProjectMappings_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContactProjectMappings_Tenants_TenantId", - column: x => x.TenantId, - principalTable: "Tenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ContactId", - table: "ContactProjectMappings", - column: "ContactId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_ProjectId", - table: "ContactProjectMappings", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContactProjectMappings_TenantId", - table: "ContactProjectMappings", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContactProjectMappings"); - - migrationBuilder.AddColumn( - name: "ProjectId", - table: "Contacts", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - } -} -- 2.43.0 From 1e0e277bbf45350f71c03113c059235d2c0639f0 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:44:24 +0530 Subject: [PATCH 448/469] Added an API to Update existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 83fd3d3..723752c 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2364,6 +2364,44 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } + public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (noteDto != null && id == noteDto.Id) + { + Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); + if (contact != null) + { + ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); + if (contactNote != null) + { + contactNote.Note = noteDto.Note; + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); + + + _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); + return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); + return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } + // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() -- 2.43.0 From 6e2b0eaec0262666fa07ac66c2e29b16e0747bd2 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 16:45:10 +0530 Subject: [PATCH 449/469] Added an API to suspend a n existing Contact-note --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 723752c..7fd68f0 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2401,6 +2401,28 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteContactNote(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + if (note != null) + { + note.IsActive = false; + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } // -------------------------------- Bucket -------------------------------- -- 2.43.0 From 3f7464643719cbfcc70d9a17b15ba04f7ffb7a28 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:24:41 +0530 Subject: [PATCH 450/469] Enhancement #375: Update "Get Contact" API to Enforce Feature Permissions --- .../Controllers/DirectoryController.cs | 5 +++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 22 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index fcd82a7..de262fb 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -39,12 +39,17 @@ namespace Marco.Pms.Services.Controllers { return Ok(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); } } + [HttpGet("contact-bucket/{bucketId}")] public async Task GetContactsListByBucketId(Guid bucketId) { diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 7fd68f0..318a2f7 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1357,9 +1357,29 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - List filterbucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + if (permissionIds.Contains(directoryAdmin)) + { + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketIds = buckets.Select(b => b.Id).ToList(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + var createdBucketIds = buckets.Select(b => b.Id).ToList(); + bucketIds.AddRange(createdBucketIds); + bucketIds = bucketIds.Distinct().ToList(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a contacts, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + + List filterbucketIds = bucketIds; if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) { filterbucketIds = filterDto.BucketIds; -- 2.43.0 From ac837ef24164c00393df1efb6b416fc2f132df45 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:27:04 +0530 Subject: [PATCH 451/469] Enhancement #376: Update "Get Contact by Bucket ID" API to Enforce Feature Permissions --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 318a2f7..630bb10 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1504,12 +1504,37 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (id != Guid.Empty) { - EmployeeBucketMapping? employeeBucket = await _context.EmployeeBucketMappings.FirstOrDefaultAsync(em => em.BucketId == id && em.EmployeeId == LoggedInEmployee.Id); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == id && b.TenantId == tenantId); + if (bucket == null) + { + _logger.LogInfo("Employee ID {EmployeeId} attempted access to bucket ID {BucketId}, but not found in database", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(em => em.BucketId == id).ToListAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + + EmployeeBucketMapping? employeeBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + employeeBucket = employeeBuckets.FirstOrDefault(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + employeeBucket = employeeBuckets.FirstOrDefault(eb => eb.EmployeeId == LoggedInEmployee.Id); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a contacts with in bucket {BucketId}, but do not have permission", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + if (employeeBucket == null) { _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); } + List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); List contactVMs = new List(); if (contactBucket.Count > 0) -- 2.43.0 From 404c16946bfeca64e0e60ac1cc2b6ddd3aa06910 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:28:22 +0530 Subject: [PATCH 452/469] Enhancement #377: Update "Update Contact" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 4 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index de262fb..6b54891 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -103,6 +103,10 @@ namespace Marco.Pms.Services.Controllers { return NotFound(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 630bb10..bc14302 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1795,6 +1795,33 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); + List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); + if (permissionIds.Contains(directoryAdmin)) + { + var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketIds = buckets.Select(b => b.Id).ToList(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + var createdBucketIds = buckets.Select(b => b.Id).ToList(); + bucketIds.AddRange(createdBucketIds); + bucketIds = bucketIds.Distinct().ToList(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to update a contact, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + + List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id && bucketIds.Contains(m.BucketId)).ToListAsync(); + bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + + + var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); _context.Contacts.Update(newContact); await _context.SaveChangesAsync(); @@ -1804,8 +1831,7 @@ namespace Marco.Pms.Services.Helpers List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var emailIds = emails.Select(p => p.Id).ToList(); - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); + List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); -- 2.43.0 From aad79953f57e4c1bc3044090f9a5858caddce836 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:32:51 +0530 Subject: [PATCH 453/469] Enhancement #378: Update "Get Bucket List" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 13 ++++++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 28 +++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 6b54891..d25c7e8 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -226,7 +226,18 @@ namespace Marco.Pms.Services.Controllers public async Task GetBucketList() { var response = await _directoryHelper.GetBucketList(); - return Ok(response); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } } [HttpPost("bucket")] diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index bc14302..d2a27ff 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2501,20 +2501,38 @@ namespace Marco.Pms.Services.Helpers { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - List bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id)).ToListAsync(); + List bucketList = new List(); + if (permissionIds.Contains(directoryAdmin)) + { + bucketList = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + } + else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) + { + bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + } + else + { + _logger.LogError("Employee {EmployeeId} attemped to access a buckets list, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } List bucketVMs = new List(); - foreach (var bucket in bucketList) + if (bucketList.Any()) { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); + foreach (var bucket in bucketList) + { + BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + bucketVMs.Add(bucketVM); + } } _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, System.String.Format("{0} buckets fetched successfully", bucketVMs.Count), 200); + return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); } public async Task> CreateBucket(CreateBucketDto bucketDto) { -- 2.43.0 From 915ad7bdb5dd5f01712d6ba4fab9d3ed1c65b11f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:35:09 +0530 Subject: [PATCH 454/469] Enhancement #380: Update "Create Bucket" API to Enforce Feature --- Marco.Pms.Services/Controllers/DirectoryController.cs | 4 ++++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index d25c7e8..680a708 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -261,6 +261,10 @@ namespace Marco.Pms.Services.Controllers { return Conflict(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index d2a27ff..515ab3f 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2540,6 +2540,15 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (bucketDto != null) { + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var demo = !permissionIds.Contains(directoryUser); + if (!permissionIds.Contains(directoryAdmin) && !permissionIds.Contains(directoryManager) && !permissionIds.Contains(directoryUser)) + { + _logger.LogError("Employee {EmployeeId} attemped to create a bucket, but do not have permission", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); + } + var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); if (existingBucket != null) { -- 2.43.0 From 49988c98144fa00ece9f0e22388262ada2b9a030 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 12:37:24 +0530 Subject: [PATCH 455/469] Enhancement #381: Update "Update Bucket" API to Enforce Feature --- .../Controllers/DirectoryController.cs | 4 +++ Marco.Pms.Services/Helpers/DirectoryHelper.cs | 29 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 680a708..cfc9ed8 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -284,6 +284,10 @@ namespace Marco.Pms.Services.Controllers { return NotFound(response); } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } else { return BadRequest(response); diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 515ab3f..1b9265e 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2587,12 +2587,39 @@ namespace Marco.Pms.Services.Helpers var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); if (bucketDto != null && id == bucketDto.Id) { - var bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var bucketIds = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToListAsync(); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + if (bucket == null) { _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); } + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + bucket.Name = bucketDto.Name ?? ""; bucket.Description = bucketDto.Description ?? ""; -- 2.43.0 From ae08ebeae52bf7d73b57195030481ab7bf474405 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 27 May 2025 16:29:42 +0530 Subject: [PATCH 456/469] Implement API to Assign Bucket to Employees --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 9 ++ .../Controllers/DirectoryController.cs | 24 +++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 116 +++++++++++++++++- 3 files changed, 144 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 68ea44e..2aea3c0 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -202,6 +202,15 @@ namespace Marco.Pms.Model.Mapper Description = bucket.Description }; } + public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) + { + return new AssignBucketVM + { + Id = bucket.Id, + Name = bucket.Name, + Description = bucket.Description + }; + } //Contact Note public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index cfc9ed8..192143d 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -177,7 +177,7 @@ namespace Marco.Pms.Services.Controllers } } - [HttpGet("note/{ContactId}")] + [HttpGet("notes/{ContactId}")] public async Task GetNoteListByContactId(Guid contactId, [FromQuery] bool active = true) { var response = await _directoryHelper.GetNoteListByContactId(contactId, active); @@ -293,5 +293,27 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } + + [HttpPost("assign-bucket/{bucketId}")] + public async Task AssignBucket(Guid bucketId, [FromBody] List assignBuckets) + { + var response = await _directoryHelper.AssignBucket(bucketId, assignBuckets); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 1b9265e..725e39d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2522,15 +2522,21 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); } - List bucketVMs = new List(); + List bucketVMs = new List(); if (bucketList.Any()) { foreach (var bucket in bucketList) { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + bucketVM.EmployeeIds = emplyeeIds; + bucketVMs.Add(bucketVM); } } + _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); } @@ -2589,7 +2595,8 @@ namespace Marco.Pms.Services.Helpers { var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - var bucketIds = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToListAsync(); + var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); if (bucket == null) @@ -2632,13 +2639,114 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + bucketVM.EmployeeIds = employeeIds; + _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); } _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> AssignBucket(Guid bucketId, List assignBuckets) + { + Guid tenantId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + if (assignBuckets != null && bucketId != Guid.Empty) + { + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); + + if (bucket == null) + { + _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); + } + var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(bucketId)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + var employeeIds = await _context.Employees.Where(e => e.TenantId == tenantId && e.IsActive).Select(e => e.Id).ToListAsync(); + int assignedEmployee = 0; + int removededEmployee = 0; + foreach (var assignBucket in assignBuckets) + { + if (employeeIds.Contains(assignBucket.EmployeeId)) + { + if (assignBucket.IsActive) + { + EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping + { + EmployeeId = assignBucket.EmployeeId, + BucketId = bucketId + }; + _context.EmployeeBucketMappings.Add(employeeBucketMapping); + assignedEmployee += 1; + } + else + { + EmployeeBucketMapping? employeeBucketMapping = employeeBuckets.FirstOrDefault(eb => eb.BucketId == bucketId && eb.EmployeeId == assignBucket.EmployeeId); + if (employeeBucketMapping != null) + { + _context.EmployeeBucketMappings.Remove(employeeBucketMapping); + removededEmployee += 1; + } + } + } + } + + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = bucketId, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + + await _context.SaveChangesAsync(); + + AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); + List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); + employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); + bucketVM.EmployeeIds = employeeIds; + + + if (assignedEmployee > 0) + { + _logger.LogInfo("Employee {EmployeeId} assigned bucket {BucketId} to {conut} number of employees", LoggedInEmployee.Id, bucketId, assignedEmployee); + } + if (removededEmployee > 0) + { + _logger.LogError("Employee {EmployeeId} removed {conut} number of employees from bucket {BucketId}", LoggedInEmployee.Id, removededEmployee, bucketId); + } + return ApiResponse.SuccessResponse(bucketVM, "Details updated successfully", 200); + } + _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); + return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From 138eb963d072b955d6a791fb69319719ea1e9162 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 10:40:00 +0530 Subject: [PATCH 457/469] Implemented an API to delete a Bucket --- .../Controllers/DirectoryController.cs | 30 ++++++- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 78 +++++++++++++++++-- 2 files changed, 99 insertions(+), 9 deletions(-) diff --git a/Marco.Pms.Services/Controllers/DirectoryController.cs b/Marco.Pms.Services/Controllers/DirectoryController.cs index 192143d..2bf22ea 100644 --- a/Marco.Pms.Services/Controllers/DirectoryController.cs +++ b/Marco.Pms.Services/Controllers/DirectoryController.cs @@ -139,9 +139,9 @@ namespace Marco.Pms.Services.Controllers } [HttpDelete("{id}")] - public async Task DeleteContact(Guid id) + public async Task DeleteContact(Guid id, [FromQuery] bool? active) { - var response = await _directoryHelper.DeleteContact(id); + var response = await _directoryHelper.DeleteContact(id, active ?? false); if (response.StatusCode == 200) { return Ok(response); @@ -214,9 +214,9 @@ namespace Marco.Pms.Services.Controllers } [HttpDelete("note/{id}")] - public async Task DeleteContactNote(Guid id) + public async Task DeleteContactNote(Guid id, [FromQuery] bool? active) { - var response = await _directoryHelper.DeleteContactNote(id); + var response = await _directoryHelper.DeleteContactNote(id, active ?? false); return Ok(response); } @@ -315,5 +315,27 @@ namespace Marco.Pms.Services.Controllers return BadRequest(response); } } + + [HttpDelete("bucket/{id}")] + public async Task DeleteBucket(Guid id) + { + var response = await _directoryHelper.DeleteBucket(id); + if (response.StatusCode == 200) + { + return Ok(response); + } + else if (response.StatusCode == 404) + { + return NotFound(response); + } + else if (response.StatusCode == 401) + { + return Unauthorized(response); + } + else + { + return BadRequest(response); + } + } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 725e39d..ca8669d 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2181,7 +2181,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); } - public async Task> DeleteContact(Guid id) + public async Task> DeleteContact(Guid id, bool active) { Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -2193,7 +2193,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); } - contact.IsActive = false; + contact.IsActive = active; _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog { @@ -2219,7 +2219,15 @@ namespace Marco.Pms.Services.Helpers Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); if (contact != null) { - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive == active).ToListAsync(); + List notes = new List(); + if (active) + { + notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive && n.TenantId == tenantId).ToListAsync(); + } + else + { + notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); + } List? noteVMs = new List(); foreach (var note in notes) { @@ -2292,7 +2300,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } - public async Task> DeleteContactNote(Guid id) + public async Task> DeleteContactNote(Guid id, bool active) { Guid tenentId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -2300,7 +2308,7 @@ namespace Marco.Pms.Services.Helpers ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); if (note != null) { - note.IsActive = false; + note.IsActive = active; _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog { RefereanceId = id, @@ -2747,6 +2755,66 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); } + public async Task> DeleteBucket(Guid id) + { + Guid tenentId = _userHelper.GetTenantId(); + var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + + if (bucket != null) + { + List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + List? contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); + + if (contactBuckets.Any()) + { + _logger.LogInfo("Employee {EmployeeId} attempted to deleted bucket {BucketId},but bucket have contacts in it.", LoggedInEmployee.Id, id); + return ApiResponse.ErrorResponse("This bucket can not be deleted", "This bucket can not be deleted", 400); + } + + var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); + var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); + var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); + + Bucket? accessableBucket = null; + if (permissionIds.Contains(directoryAdmin)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) + { + accessableBucket = bucket; + } + else if (permissionIds.Contains(directoryUser)) + { + if (bucket.CreatedByID == LoggedInEmployee.Id) + { + accessableBucket = bucket; + } + } + if (accessableBucket == null) + { + _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); + return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); + } + + _context.EmployeeBucketMappings.RemoveRange(employeeBuckets); + _context.Buckets.Remove(bucket); + _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog + { + RefereanceId = id, + UpdatedById = LoggedInEmployee.Id, + UpdateAt = DateTime.UtcNow + }); + await _context.SaveChangesAsync(); + _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + } + + _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); + return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); + } private bool Compare(string sentence, string search) { sentence = sentence.Trim().ToLower(); -- 2.43.0 From b88dbea6c68c787843fba010b20ebb76fdbe98a1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 10:45:03 +0530 Subject: [PATCH 458/469] Corrected Spelling mistakes --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index ca8669d..3aac1ae 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2302,10 +2302,10 @@ namespace Marco.Pms.Services.Helpers } public async Task> DeleteContactNote(Guid id, bool active) { - Guid tenentId = _userHelper.GetTenantId(); + Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); if (note != null) { note.IsActive = active; @@ -2757,10 +2757,10 @@ namespace Marco.Pms.Services.Helpers } public async Task> DeleteBucket(Guid id) { - Guid tenentId = _userHelper.GetTenantId(); + Guid tenantId = _userHelper.GetTenantId(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); + Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); if (bucket != null) { @@ -2809,7 +2809,7 @@ namespace Marco.Pms.Services.Helpers }); await _context.SaveChangesAsync(); _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); + return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); } _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); -- 2.43.0 From 4abeb8cf5a3ce53c3706b5f607a96d6ac8665f72 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 11:36:40 +0530 Subject: [PATCH 459/469] Sending number of conacts within the bucket with it information in API Update bucket, Assign Bucket, and Get Bucket List --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 3aac1ae..2529b96 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2533,14 +2533,16 @@ namespace Marco.Pms.Services.Helpers List bucketVMs = new List(); if (bucketList.Any()) { + bucketIds = bucketList.Select(b => b.Id).ToList(); + List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); foreach (var bucket in bucketList) { List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); - + List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); bucketVM.EmployeeIds = emplyeeIds; - + bucketVM.NumberOfContacts = contactBuckets.Count; bucketVMs.Add(bucketVM); } } @@ -2649,8 +2651,10 @@ namespace Marco.Pms.Services.Helpers AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); bucketVM.EmployeeIds = employeeIds; + bucketVM.NumberOfContacts = contactBuckets.Count; _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); @@ -2738,9 +2742,10 @@ namespace Marco.Pms.Services.Helpers AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); + List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); bucketVM.EmployeeIds = employeeIds; - + bucketVM.NumberOfContacts = contactBuckets.Count; if (assignedEmployee > 0) { -- 2.43.0 From 7dc80ec0066205fd545f2c7b1450744edd8a9dff Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 12:48:02 +0530 Subject: [PATCH 460/469] Included object consist of basic infromation of employee who created the bucket in View models --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 6 ++++-- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 2aea3c0..4732542 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -199,7 +199,8 @@ namespace Marco.Pms.Model.Mapper { Id = bucket.Id, Name = bucket.Name, - Description = bucket.Description + Description = bucket.Description, + CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null }; } public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) @@ -208,7 +209,8 @@ namespace Marco.Pms.Model.Mapper { Id = bucket.Id, Name = bucket.Name, - Description = bucket.Description + Description = bucket.Description, + CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null }; } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 2529b96..458f576 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2518,11 +2518,11 @@ namespace Marco.Pms.Services.Helpers List bucketList = new List(); if (permissionIds.Contains(directoryAdmin)) { - bucketList = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); + bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => b.TenantId == tenantId).ToListAsync(); } else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) { - bucketList = await _context.Buckets.Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); + bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); } else { @@ -2589,7 +2589,7 @@ namespace Marco.Pms.Services.Helpers _context.EmployeeBucketMappings.Add(employeeBucket); await _context.SaveChangesAsync(); - + bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucket.Id) ?? new Bucket(); BucketVM bucketVM = bucket.ToBucketVMFromBucket(); _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); @@ -2607,7 +2607,7 @@ namespace Marco.Pms.Services.Helpers var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); + Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); if (bucket == null) { @@ -2671,7 +2671,7 @@ namespace Marco.Pms.Services.Helpers var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); + Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); if (bucket == null) { -- 2.43.0 From af9e06cd98260a5f2263fb5415fc63734d2bdc51 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:00:56 +0530 Subject: [PATCH 461/469] Sending last updatedBy and updatedAt when sending list of notes --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 458f576..59e1782 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2228,11 +2228,25 @@ namespace Marco.Pms.Services.Helpers { notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); } + var noteIds = notes.Select(n => n.Id).ToList(); + List? updateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.RefereanceId)).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); + DirectoryUpdateLog? updateLog = updateLogs.Where(l => l.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); + if (updateLog != null) + { + noteVM.UpdatedAt = updateLog.UpdateAt; + noteVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; + } + else + { + noteVM.UpdatedAt = note.CreatedAt; + noteVM.UpdatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null; + } noteVMs.Add(noteVM); + } _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); -- 2.43.0 From a6fc75f4925a075ae07e835ad643956a9e2ee892 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:14:31 +0530 Subject: [PATCH 462/469] Stopping multiple entries in employee-bucket mapping table --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 59e1782..2a7b1a8 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2694,7 +2694,7 @@ namespace Marco.Pms.Services.Helpers } var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - + var employeeBucketIds = employeeBuckets.Select(eb => eb.EmployeeId).ToList(); Bucket? accessableBucket = null; if (permissionIds.Contains(directoryAdmin)) { @@ -2723,7 +2723,7 @@ namespace Marco.Pms.Services.Helpers { if (employeeIds.Contains(assignBucket.EmployeeId)) { - if (assignBucket.IsActive) + if (assignBucket.IsActive && !employeeBucketIds.Contains(assignBucket.EmployeeId)) { EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping { -- 2.43.0 From 0db199e74f370cd8159a7f925b985a393e408f78 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 28 May 2025 15:55:00 +0530 Subject: [PATCH 463/469] fixed the bug of only sending ID of logged in employee in Bucket object --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 2a7b1a8..a7988ee 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2528,7 +2528,7 @@ namespace Marco.Pms.Services.Helpers List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - + List employeeBucketVM = await _context.EmployeeBucketMappings.Where(b => bucketIds.Contains(b.BucketId)).ToListAsync(); List bucketList = new List(); if (permissionIds.Contains(directoryAdmin)) { @@ -2551,7 +2551,7 @@ namespace Marco.Pms.Services.Helpers List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); foreach (var bucket in bucketList) { - List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); + List employeeBucketMappings = employeeBucketVM.Where(eb => eb.BucketId == bucket.Id).ToList(); var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); -- 2.43.0 From 361a2ab5c3529526ca99960d6835da29bbc82908 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Thu, 29 May 2025 11:49:08 +0530 Subject: [PATCH 464/469] Sending Is Active in Object Of Contact notes --- Marco.Pms.Model/Mapper/DirectoryMapper.cs | 3 ++- Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs | 1 + Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 4732542..381c4b0 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -234,7 +234,8 @@ namespace Marco.Pms.Model.Mapper Note = note.Note, ContactId = note.ContactId, CreatedAt = note.CreatedAt, - CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null + CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null, + IsActive = note.IsActive }; } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs index c3ca209..c00b0de 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactNoteVM.cs @@ -11,5 +11,6 @@ namespace Marco.Pms.Model.ViewModels.Directory public DateTime? UpdatedAt { get; set; } public BasicEmployeeVM? UpdatedBy { get; set; } public Guid ContactId { get; set; } + public bool IsActive { get; set; } } } diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index a7988ee..2be0f01 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -2150,7 +2150,7 @@ namespace Marco.Pms.Services.Helpers if (notes.Any()) { List? noteIds = notes.Select(n => n.Id).ToList(); - List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.Id)).OrderByDescending(l => l.UpdateAt).ToListAsync(); + List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.RefereanceId)).OrderByDescending(l => l.UpdateAt).ToListAsync(); List? noteVMs = new List(); foreach (var note in notes) { -- 2.43.0 From 4f0515f8f46792b95d0a7326104d5b2c5dacc960 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Mon, 9 Jun 2025 09:46:30 +0530 Subject: [PATCH 465/469] created new dto for projectAllocation for employee --- Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs b/Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs index 1634a84..7a1fd91 100644 --- a/Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs +++ b/Marco.Pms.Model/Dtos/Projects/ProjectAllocationDot.cs @@ -8,4 +8,13 @@ public bool Status { get; set; } } + + + public class ProjectsAllocationDto + { + public Guid ProjectId { get; set; } + public Guid JobRoleId { get; set; } + + public bool Status { get; set; } + } } -- 2.43.0 From 9ed615110df193f05dba3cf6ebd2b33a81ff20b5 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Mon, 9 Jun 2025 09:48:35 +0530 Subject: [PATCH 466/469] created two end pointe for assigne and unassign project for perticular employee --- .../Controllers/ProjectController.cs | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/Marco.Pms.Services/Controllers/ProjectController.cs b/Marco.Pms.Services/Controllers/ProjectController.cs index af8b1d2..b05a528 100644 --- a/Marco.Pms.Services/Controllers/ProjectController.cs +++ b/Marco.Pms.Services/Controllers/ProjectController.cs @@ -13,6 +13,7 @@ using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace MarcoBMS.Services.Controllers { @@ -682,5 +683,122 @@ namespace MarcoBMS.Services.Controllers } + [HttpGet("assigned-projects/{employeeId}")] + public async Task GetProjectsByEmployee([FromRoute] Guid employeeId) + { + + Guid tenantId = _userHelper.GetTenantId(); + if (employeeId == Guid.Empty) + { + return BadRequest(ApiResponse.ErrorResponse("Invalid details.", "Employee id not valid.", 400)); + } + + List projectList = await _context.ProjectAllocations + .Where(c => c.TenantId == tenantId && c.EmployeeId == employeeId && c.IsActive) + .Select(c => c.ProjectId).Distinct() + .ToListAsync(); + + if (!projectList.Any()) + { + return NotFound(ApiResponse.SuccessResponse(new List(), "No projects found.",200)); + } + + + List projectlist = await _context.Projects + .Where(p => projectList.Contains(p.Id)) + .ToListAsync(); + + List projects = new List(); + + + foreach (var project in projectlist) { + + projects.Add(project.ToProjectListVMFromProject()); + } + + + + return Ok(ApiResponse.SuccessResponse(projects, "Success.", 200)); + } + + + + + [HttpPost("assign-projects/{employeeId}")] + public async Task AssigneProjectsToEmployee([FromBody] List projectAllocationDtos, [FromRoute] Guid employeeId) + { + if(projectAllocationDtos != null && employeeId != Guid.Empty) + { + Guid TenentID = GetTenantId(); + List? result = new List(); + + foreach(var projectAllocationDto in projectAllocationDtos) + { + try + { + ProjectAllocation projectAllocation = projectAllocationDto.ToProjectAllocationFromProjectsAllocationDto(TenentID,employeeId); + ProjectAllocation? projectAllocationFromDb = await _context.ProjectAllocations.Where(c => c.EmployeeId == employeeId && c.ProjectId == projectAllocationDto.ProjectId && c.ReAllocationDate == null && c.TenantId == TenentID).SingleOrDefaultAsync(); + + if(projectAllocationFromDb != null) + { + + + _context.ProjectAllocations.Attach(projectAllocationFromDb); + + if (projectAllocationDto.Status) + { + projectAllocationFromDb.JobRoleId = projectAllocation.JobRoleId; ; + projectAllocationFromDb.IsActive = true; + _context.Entry(projectAllocationFromDb).Property(e => e.JobRoleId).IsModified = true; + _context.Entry(projectAllocationFromDb).Property(e => e.IsActive).IsModified = true; + } + else + { + projectAllocationFromDb.ReAllocationDate = DateTime.UtcNow; + projectAllocationFromDb.IsActive = false; + _context.Entry(projectAllocationFromDb).Property(e => e.ReAllocationDate).IsModified = true; + _context.Entry(projectAllocationFromDb).Property(e => e.IsActive).IsModified = true; + } + await _context.SaveChangesAsync(); + var result1 = new + { + Id = projectAllocationFromDb.Id, + EmployeeId = projectAllocation.EmployeeId, + JobRoleId = projectAllocation.JobRoleId, + IsActive = projectAllocation.IsActive, + ProjectId = projectAllocation.ProjectId, + AllocationDate = projectAllocation.AllocationDate, + ReAllocationDate = projectAllocation.ReAllocationDate, + TenantId = projectAllocation.TenantId + }; + result.Add(result1); + } + else + { + projectAllocation.AllocationDate = DateTime.Now; + projectAllocation.IsActive = true; + _context.ProjectAllocations.Add(projectAllocation); + await _context.SaveChangesAsync(); + + } + + + } + catch (Exception ex) { + + return Ok(ApiResponse.ErrorResponse(ex.Message, ex, 400)); + } + } + + return Ok(ApiResponse.SuccessResponse(result, "Data saved successfully", 200)); + } + else + { + return BadRequest(ApiResponse.ErrorResponse("Invalid details.", "All Field is required", 400)); + } + + } + + } } \ No newline at end of file -- 2.43.0 From 7dfed25d8e126d56b9a90ae1007947095e96d1ce Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Mon, 9 Jun 2025 12:16:02 +0530 Subject: [PATCH 467/469] created new DTO for projectsallocation for one specific employee --- Marco.Pms.Model/Mapper/ProjectMapper.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Marco.Pms.Model/Mapper/ProjectMapper.cs b/Marco.Pms.Model/Mapper/ProjectMapper.cs index 75588c5..7211e03 100644 --- a/Marco.Pms.Model/Mapper/ProjectMapper.cs +++ b/Marco.Pms.Model/Mapper/ProjectMapper.cs @@ -61,6 +61,19 @@ namespace Marco.Pms.Model.Mapper }; } + + public static ProjectAllocation ToProjectAllocationFromProjectsAllocationDto(this ProjectsAllocationDto model, Guid TenantId,Guid employeeId) + { + return new ProjectAllocation + { + AllocationDate = DateTime.Now, + EmployeeId = employeeId, + JobRoleId = model.JobRoleId, + TenantId = TenantId, + ProjectId = model.ProjectId + }; + } + public static ProjectListVM ToProjectListVMFromProject(this Project project) { return new ProjectListVM -- 2.43.0 From b61caa9ee7f601d48fd8dc7f1e65a2ceeaa4befd Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Mon, 9 Jun 2025 20:22:36 +0530 Subject: [PATCH 468/469] Fixed rebase confilets --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 1501 +---------------- Marco.Pms.Services/Helpers/MasterHelper.cs | 1 + 2 files changed, 2 insertions(+), 1500 deletions(-) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 2be0f01..d34b0d3 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -9,6 +9,7 @@ using Marco.Pms.Model.ViewModels.Master; using Marco.Pms.Model.ViewModels.Projects; using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Service; +using Microsoft.EntityFrameworkCore; namespace Marco.Pms.Services.Helpers { @@ -33,1326 +34,6 @@ namespace Marco.Pms.Services.Helpers - public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto, Guid? projectId) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); - var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - if (permissionIds.Contains(directoryAdmin)) - { - var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); - bucketIds = buckets.Select(b => b.Id).ToList(); - } - else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) - { - var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); - var createdBucketIds = buckets.Select(b => b.Id).ToList(); - bucketIds.AddRange(createdBucketIds); - bucketIds = bucketIds.Distinct().ToList(); - } - else - { - _logger.LogError("Employee {EmployeeId} attemped to access a contacts, but do not have permission", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); - } - - List filterbucketIds = bucketIds; - if (filterDto != null && filterDto.BucketIds != null && filterDto.BucketIds.Count > 0) - { - filterbucketIds = filterDto.BucketIds; - } - List? contactBuckets = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - List contactIds = contactBuckets.Where(b => filterbucketIds.Contains(b.BucketId)).Select(cb => cb.ContactId).ToList(); - List contacts = new List(); - - var contactProjects = await _context.ContactProjectMappings.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - - if (projectId != null && projectId != Guid.Empty) - { - contactProjects = contactProjects.Where(p => p.ProjectId == projectId).ToList(); - contactIds = contactProjects.Select(p => p.ContactId).Distinct().ToList(); - } - - if (filterDto != null && filterDto.CategoryIds != null && filterDto.CategoryIds.Count > 0) - { - var categoryIds = filterDto.CategoryIds; - contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && categoryIds.Contains(c.ContactCategoryId ?? Guid.Empty) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); - } - else - { - contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.TenantId == tenantId && c.IsActive == active).ToListAsync(); - } - - - - - var phoneNo = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - var Emails = await _context.ContactsEmails.Where(E => contactIds.Contains(E.ContactId)).ToListAsync(); - var Tags = await _context.ContactTagMappings.Where(t => contactIds.Contains(t.ContactId)).ToListAsync(); - - List TagIds = Tags.Select(t => t.ContactTagId).ToList(); - - var TagList = await _context.ContactTagMasters.Where(t => TagIds.Contains(t.Id)).ToListAsync(); - - if (search != null && search != string.Empty) - { - List filteredContactIds = new List(); - phoneNo = phoneNo.Where(p => Compare(p.PhoneNumber, search)).ToList(); - filteredContactIds = phoneNo.Select(p => p.ContactId).ToList(); - - Emails = Emails.Where(e => Compare(e.EmailAddress, search)).ToList(); - filteredContactIds.AddRange(Emails.Select(e => e.ContactId).ToList()); - filteredContactIds = filteredContactIds.Distinct().ToList(); - - contacts = contacts.Where(c => Compare(c.Name, search) || Compare(c.Organization, search) || filteredContactIds.Contains(c.Id)).ToList(); - } - - List list = new List(); - - foreach (var contact in contacts) - { - - ContactVM contactVM = new ContactVM(); - List contactEmailVms = new List(); - List contactPhoneVms = new List(); - - List conatctTagVms = new List(); - var phones = phoneNo.Where(p => p.ContactId == contact.Id).ToList(); - var emails = Emails.Where(e => e.ContactId == contact.Id).ToList(); - var tagMappingss = Tags.Where(t => t.ContactId == contact.Id).ToList(); - var projectMapping = contactProjects.Where(p => p.ContactId == contact.Id).ToList(); - var bucketMapping = contactBuckets.Where(b => b.ContactId == contact.Id).ToList(); - - - if (emails != null && emails.Count > 0) - { - foreach (var email in emails) - { - ContactEmailVM emailVM = new ContactEmailVM(); - emailVM = email.ToContactEmailVMFromContactEmail(); - contactEmailVms.Add(emailVM); - } - } - - if (phones != null && phones.Count > 0) - { - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = new ContactPhoneVM(); - phoneVM = phone.ToContactPhoneVMFromContactPhone(); - contactPhoneVms.Add(phoneVM); - } - - } - if (tagMappingss != null && tagMappingss.Count > 0) - { - foreach (var tagMapping in tagMappingss) - { - ContactTagVM tagVM = new ContactTagVM(); ; - var tag = TagList.Find(t => t.Id == tagMapping.ContactTagId); - - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - conatctTagVms.Add(tagVM); - - - } - } - contactVM = contact.ToContactVMFromContact(); - - if (projectMapping != null && projectMapping.Count > 0) - { - contactVM.ProjectIds = projectMapping.Select(p => p.ProjectId).ToList(); - } - if (bucketMapping != null && bucketMapping.Count > 0) - { - contactVM.BucketIds = bucketMapping.Select(p => p.BucketId).ToList(); - } - - contactVM.ContactEmails = contactEmailVms; - contactVM.ContactPhones = contactPhoneVms; - contactVM.Tags = conatctTagVms; - - list.Add(contactVM); - } - _logger.LogInfo("{count} contacts are fetched by Employee with ID {LoggedInEmployeeId}", list.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(list, System.String.Format("{0} contacts fetched successfully", list.Count), 200); - - } - public async Task> GetContactsListByBucketId(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Id == id && b.TenantId == tenantId); - if (bucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} attempted access to bucket ID {BucketId}, but not found in database", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); - } - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(em => em.BucketId == id).ToListAsync(); - var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); - var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - - EmployeeBucketMapping? employeeBucket = null; - if (permissionIds.Contains(directoryAdmin)) - { - employeeBucket = employeeBuckets.FirstOrDefault(); - } - else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) - { - employeeBucket = employeeBuckets.FirstOrDefault(eb => eb.EmployeeId == LoggedInEmployee.Id); - } - else - { - _logger.LogError("Employee {EmployeeId} attemped to access a contacts with in bucket {BucketId}, but do not have permission", LoggedInEmployee.Id, id); - return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); - } - - if (employeeBucket == null) - { - _logger.LogInfo("Employee ID {EmployeeId} does not have access to bucket ID {BucketId}", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You do not have access to this bucket.", "You do not have access to this bucket.", 401); - } - - List contactBucket = await _context.ContactBucketMappings.Where(cb => cb.BucketId == id).ToListAsync() ?? new List(); - List contactVMs = new List(); - if (contactBucket.Count > 0) - { - var contactIds = contactBucket.Select(cb => cb.ContactId).ToList(); - List contacts = await _context.Contacts.Include(c => c.ContactCategory).Where(c => contactIds.Contains(c.Id) && c.IsActive).ToListAsync(); - List phones = await _context.ContactsPhones.Where(p => contactIds.Contains(p.ContactId)).ToListAsync(); - List emails = await _context.ContactsEmails.Where(e => contactIds.Contains(e.ContactId)).ToListAsync(); - - List? tags = await _context.ContactTagMappings.Where(ct => contactIds.Contains(ct.ContactId)).ToListAsync(); - List? contactProjects = await _context.ContactProjectMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(cp => contactIds.Contains(cp.ContactId)).ToListAsync(); - - List tagIds = new List(); - List tagMasters = new List(); - if (tags.Count > 0) - { - tagIds = tags.Select(ct => ct.ContactTagId).ToList(); - tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - } - - if (contacts.Count > 0) - { - - - foreach (var contact in contacts) - { - List? emailVMs = new List(); - List? phoneVMs = new List(); - List? tagVMs = new List(); - - List contactPhones = phones.Where(p => p.ContactId == contact.Id).ToList(); - List contactEmails = emails.Where(e => e.ContactId == contact.Id).ToList(); - - List? contactTags = tags.Where(t => t.ContactId == contact.Id).ToList(); - List? projectMappings = contactProjects.Where(cp => cp.ContactId == contact.Id).ToList(); - List? bucketMappings = contactBuckets.Where(cb => cb.ContactId == contact.Id).ToList(); - - if (contactPhones.Count > 0) - { - foreach (var phone in contactPhones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - } - if (contactEmails.Count > 0) - { - foreach (var email in contactEmails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - } - if (contactTags.Count > 0) - { - foreach (var contactTag in contactTags) - { - ContactTagMaster? tagMaster = tagMasters.Find(t => t.Id == contactTag.ContactTagId); - if (tagMaster != null) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - } - } - ContactVM contactVM = contact.ToContactVMFromContact(); - contactVM.ContactEmails = emailVMs; - contactVM.ContactPhones = phoneVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = projectMappings.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - contactVMs.Add(contactVM); - } - } - - } - _logger.LogInfo("{count} contact from Bucket {BucketId} fetched by Employee {EmployeeId}", contactVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVMs, $"{contactVMs.Count} contacts fetched successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty Bucket id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket ID is empty", "Bucket ID is empty", 400); - } - public async Task> CreateContact(CreateContactDto createContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (createContact != null) - { - List phones = new List(); - List emails = new List(); - List contactBucketMappings = new List(); - List contactTagMappings = new List(); - - Contact? contact = createContact.ToContactFromCreateContactDto(tenantId, LoggedInEmployee.Id); - - _context.Contacts.Add(contact); - await _context.SaveChangesAsync(); - _logger.LogInfo("Contact with ID {ContactId} created by Employee with ID {LoggedInEmployeeId}", contact.Id, LoggedInEmployee.Id); - - var tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); - var tagNames = tags.Select(t => t.Name.ToLower()).ToList(); - var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).Select(b => b.Id).ToListAsync(); - var projects = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync(); - - if (createContact.ContactPhones != null) - { - - foreach (var contactPhone in createContact.ContactPhones) - { - ContactPhone phone = contactPhone.ToContactPhoneFromCreateContactPhoneDto(tenantId, contact.Id); - phones.Add(phone); - } - _context.ContactsPhones.AddRange(phones); - _logger.LogInfo("{count} phone number are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", phones.Count, contact.Id, LoggedInEmployee.Id); - } - if (createContact.ContactEmails != null) - { - - foreach (var contactEmail in createContact.ContactEmails) - { - ContactEmail email = contactEmail.ToContactEmailFromCreateContactEmailDto(tenantId, contact.Id); - emails.Add(email); - } - _context.ContactsEmails.AddRange(emails); - _logger.LogInfo("{count} email addresses are saved in contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", emails.Count, contact.Id, LoggedInEmployee.Id); - } - - if (createContact.BucketIds != null) - { - foreach (var bucket in createContact.BucketIds) - { - if (buckets.Contains(bucket)) - { - ContactBucketMapping bucketMapping = new ContactBucketMapping - { - BucketId = bucket, - ContactId = contact.Id - }; - contactBucketMappings.Add(bucketMapping); - } - } - _context.ContactBucketMappings.AddRange(contactBucketMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of buckets by employee with ID {LoggedEmployeeId}", contact.Id, contactBucketMappings.Count, LoggedInEmployee.Id); - } - - if (createContact.ProjectIds != null) - { - List projectMappings = new List(); - foreach (var projectId in createContact.ProjectIds) - { - if (projects.Contains(projectId)) - { - ContactProjectMapping projectMapping = new ContactProjectMapping - { - ProjectId = projectId, - ContactId = contact.Id, - TenantId = tenantId - }; - projectMappings.Add(projectMapping); - } - } - _context.ContactProjectMappings.AddRange(projectMappings); - _logger.LogInfo("Contact with ID {ContactId} added to {count} number of project by employee with ID {LoggedEmployeeId}", contact.Id, projectMappings.Count, LoggedInEmployee.Id); - } - - if (createContact.Tags != null) - { - foreach (var tag in createContact.Tags) - { - if (tagNames.Contains(tag.Name.ToLower())) - { - ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagId = tag.Id ?? existingTag.Id - }); - } - else if (tag.Id == null || tags.Where(t => t.Name == tag.Name) == null) - { - var newtag = new ContactTagMaster - { - Name = tag.Name, - TenantId = tenantId - }; - _context.ContactTagMasters.Add(newtag); - ContactTagMapping tagMapping = new ContactTagMapping - { - ContactTagId = newtag.Id, - ContactId = contact.Id - }; - contactTagMappings.Add(tagMapping); - } - } - - _context.ContactTagMappings.AddRange(contactTagMappings); - _logger.LogInfo("{count} number of tags added to Contact with ID {ContactId} by employee with ID {LoggedEmployeeId}", contactTagMappings.Count, contact.Id, LoggedInEmployee.Id); - } - await _context.SaveChangesAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == contact.Id) ?? new Contact(); - var tagIds = contactTagMappings.Select(t => t.ContactTagId).ToList(); - tags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId && tagIds.Contains(t.Id)).ToListAsync(); - List contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - List bucketMappings = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTagMappings) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - contactVM.BucketIds = bucketMappings.Select(cb => cb.BucketId).ToList(); - - return ApiResponse.SuccessResponse(contactVM, "Contact Created Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> UpdateContact(Guid id, UpdateContactDto updateContact) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (updateContact != null) - { - if (updateContact.Id != id) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended different ID in payload and path parameter", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Invalid data", "Invalid data", 400); - } - Contact? contact = await _context.Contacts.AsNoTracking().FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); - if (contact == null) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - - var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); - var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - List bucketIds = employeeBuckets.Select(c => c.BucketId).ToList(); - if (permissionIds.Contains(directoryAdmin)) - { - var buckets = await _context.Buckets.Where(b => b.TenantId == tenantId).ToListAsync(); - bucketIds = buckets.Select(b => b.Id).ToList(); - } - else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) - { - var buckets = await _context.Buckets.Where(b => b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); - var createdBucketIds = buckets.Select(b => b.Id).ToList(); - bucketIds.AddRange(createdBucketIds); - bucketIds = bucketIds.Distinct().ToList(); - } - else - { - _logger.LogError("Employee {EmployeeId} attemped to update a contact, but do not have permission", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); - } - - List contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(m => m.ContactId == contact.Id && bucketIds.Contains(m.BucketId)).ToListAsync(); - bucketIds = contactBuckets.Select(b => b.BucketId).Distinct().ToList(); - - - - var newContact = updateContact.ToContactFromUpdateContactDto(tenantId, contact); - _context.Contacts.Update(newContact); - await _context.SaveChangesAsync(); - - List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var phoneIds = phones.Select(p => p.Id).ToList(); - List emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - var emailIds = emails.Select(p => p.Id).ToList(); - - - - List contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); - - - List contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - var projectIds = contactProjects.Select(t => t.ProjectId).Distinct().ToList(); - - List tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - List allTags = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync(); - var tagNames = allTags.Select(t => t.Name.ToLower()).ToList(); - - if (updateContact.ContactPhones != null) - { - var updatedPhoneIds = updateContact.ContactPhones.Select(p => p.Id).Distinct().ToList(); - foreach (var phoneDto in updateContact.ContactPhones) - { - var phone = phoneDto.ToContactPhoneFromUpdateContactPhoneDto(tenantId, contact.Id); - if (phoneDto.Id != null && phoneDto.Id != Guid.Empty && phoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Update(phone); - } - else - { - _context.ContactsPhones.Add(phone); - } - } - foreach (var phone in phones) - { - - if (!updatedPhoneIds.Contains(phone.Id)) - { - _context.ContactsPhones.Remove(phone); - } - } - } - else if (phones != null) - { - _context.ContactsPhones.RemoveRange(phones); - } - - if (updateContact.ContactEmails != null) - { - var updateEmailIds = updateContact.ContactEmails.Select(p => p.Id).Distinct().ToList(); - - foreach (var emailDto in updateContact.ContactEmails) - { - var email = emailDto.ToContactEmailFromUpdateContactEmailDto(tenantId, contact.Id); - if (emailDto.Id != null && emailDto.Id != Guid.Empty && emailIds.Contains(email.Id)) - { - _context.ContactsEmails.Update(email); - } - else - { - _context.ContactsEmails.Add(email); - } - } - foreach (var email in emails) - { - - if (!updateEmailIds.Contains(email.Id)) - { - _context.ContactsEmails.Remove(email); - } - } - } - else if (emails != null) - { - _context.ContactsEmails.RemoveRange(emails); - } - - if (updateContact.BucketIds != null) - { - foreach (var bucketId in updateContact.BucketIds) - { - if (!bucketIds.Contains(bucketId)) - { - _context.ContactBucketMappings.Add(new ContactBucketMapping - { - BucketId = bucketId, - ContactId = contact.Id - }); - } - } - foreach (var bucketMapping in contactBuckets) - { - if (!updateContact.BucketIds.Contains(bucketMapping.BucketId)) - { - _context.ContactBucketMappings.Remove(bucketMapping); - } - } - } - else if (contactBuckets != null) - { - _context.ContactBucketMappings.RemoveRange(contactBuckets); - } - - if (updateContact.ProjectIds != null) - { - foreach (var ProjectId in updateContact.ProjectIds) - { - if (!projectIds.Contains(ProjectId)) - { - _context.ContactProjectMappings.Add(new ContactProjectMapping - { - ProjectId = ProjectId, - ContactId = contact.Id, - TenantId = tenantId - }); - } - } - - foreach (var projectMapping in contactProjects) - { - if (!updateContact.ProjectIds.Contains(projectMapping.ProjectId)) - { - _context.ContactProjectMappings.Remove(projectMapping); - } - } - } - else if (contactProjects != null) - { - _context.ContactProjectMappings.RemoveRange(contactProjects); - } - - if (updateContact.Tags != null) - { - var updatedTagIds = updateContact.Tags.Select(t => t.Id).Distinct().ToList(); - foreach (var tag in updateContact.Tags) - { - var namecheck = tagNames.Contains(tag.Name.ToLower()); - var idCheck = (!tagIds.Contains(tag.Id ?? Guid.Empty)); - var test = namecheck && idCheck; - if (test) - { - ContactTagMaster existingTag = tags.Find(t => t.Name == tag.Name) ?? new ContactTagMaster(); - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagId = tag.Id ?? existingTag.Id - }); - } - else if (tag.Id == null || tag.Id == Guid.Empty) - { - ContactTagMaster contactTag = new ContactTagMaster - { - Name = tag.Name, - Description = "", - TenantId = tenantId - }; - _context.ContactTagMasters.Add(contactTag); - - _context.ContactTagMappings.Add(new ContactTagMapping - { - ContactId = contact.Id, - ContactTagId = contactTag.Id - }); - } - } - foreach (var contactTag in contactTags) - { - if (!updatedTagIds.Contains(contactTag.ContactTagId)) - { - _context.ContactTagMappings.Remove(contactTag); - } - } - } - else if (contactTags != null) - { - _context.ContactTagMappings.RemoveRange(contactTags); - } - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contact.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - - contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); - phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); - contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync(); - contactBuckets = await _context.ContactBucketMappings.AsNoTracking().Where(cb => cb.ContactId == contact.Id).ToListAsync(); - contactProjects = await _context.ContactProjectMappings.AsNoTracking().Where(cp => cp.ContactId == contact.Id).ToListAsync(); - tagIds = contactTags.Select(t => t.ContactTagId).Distinct().ToList(); - tags = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - - ContactVM contactVM = new ContactVM(); - List phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - List emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - List tagVMs = new List(); - foreach (var contactTagMapping in contactTags) - { - ContactTagVM tagVM = new ContactTagVM(); - var tag = tags.Find(t => t.Id == contactTagMapping.ContactTagId); - tagVM = tag != null ? tag.ToContactTagVMFromContactTagMaster() : new ContactTagVM(); - tagVMs.Add(tagVM); - } - - - contactVM = contact.ToContactVMFromContact(); - contactVM.ContactPhones = phoneVMs; - contactVM.ContactEmails = emailVMs; - contactVM.Tags = tagVMs; - contactVM.BucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - contactVM.ProjectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - - _logger.LogInfo("Conatct {ContactId} has been updated by employee {EmployeeId}", contact.Id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(contactVM, "Contact Updated Successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> GetContactProfile(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - Contact? contact = await _context.Contacts.Include(c => c.ContactCategory).Include(c => c.CreatedBy).FirstOrDefaultAsync(c => c.Id == id && c.IsActive); - if (contact == null) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to update contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - ContactProfileVM contactVM = contact.ToContactProfileVMFromContact(); - DirectoryUpdateLog? updateLog = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => l.RefereanceId == contact.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefaultAsync(); - if (updateLog != null) - { - contactVM.UpdatedAt = updateLog.UpdateAt; - contactVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; - } - - List? phones = await _context.ContactsPhones.Where(p => p.ContactId == contact.Id).ToListAsync(); - if (phones.Any()) - { - List? phoneVMs = new List(); - foreach (var phone in phones) - { - ContactPhoneVM phoneVM = phone.ToContactPhoneVMFromContactPhone(); - phoneVMs.Add(phoneVM); - } - contactVM.ContactPhones = phoneVMs; - } - - List? emails = await _context.ContactsEmails.Where(e => e.ContactId == contact.Id).ToListAsync(); - if (emails.Any()) - { - List? emailVMs = new List(); - foreach (var email in emails) - { - ContactEmailVM emailVM = email.ToContactEmailVMFromContactEmail(); - emailVMs.Add(emailVM); - } - contactVM.ContactEmails = emailVMs; - } - - List? contactProjects = await _context.ContactProjectMappings.Where(cp => cp.ContactId == contact.Id).ToListAsync(); - if (contactProjects.Any()) - { - List projectIds = contactProjects.Select(cp => cp.ProjectId).ToList(); - List? projects = await _context.Projects.Where(p => projectIds.Contains(p.Id) && p.TenantId == tenantId).ToListAsync(); - List? projectVMs = new List(); - foreach (var project in projects) - { - BasicProjectVM projectVM = new BasicProjectVM - { - Id = project.Id, - Name = project.Name - }; - projectVMs.Add(projectVM); - } - contactVM.Projects = projectVMs; - } - List? contactBuckets = await _context.ContactBucketMappings.Where(cb => cb.ContactId == contact.Id).ToListAsync(); - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - if (contactBuckets.Any() && employeeBuckets.Any()) - { - List contactBucketIds = contactBuckets.Select(cb => cb.BucketId).ToList(); - List employeeBucketIds = employeeBuckets.Select(eb => eb.BucketId).ToList(); - List? buckets = await _context.Buckets.Where(b => contactBucketIds.Contains(b.Id) && employeeBucketIds.Contains(b.Id)).ToListAsync(); - List? bucketVMs = new List(); - foreach (var bucket in buckets) - { - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - bucketVMs.Add(bucketVM); - } - contactVM.Buckets = bucketVMs; - } - List? contactTags = await _context.ContactTagMappings.Where(ct => ct.ContactId == contact.Id).ToListAsync(); - if (contactTags.Any()) - { - List tagIds = contactTags.Select(ct => ct.ContactTagId).ToList(); - List tagMasters = await _context.ContactTagMasters.Where(t => tagIds.Contains(t.Id)).ToListAsync(); - List tagVMs = new List(); - foreach (var tagMaster in tagMasters) - { - ContactTagVM tagVM = tagMaster.ToContactTagVMFromContactTagMaster(); - tagVMs.Add(tagVM); - } - contactVM.Tags = tagVMs; - } - List? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync(); - if (notes.Any()) - { - List? noteIds = notes.Select(n => n.Id).ToList(); - List? noteUpdateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.Id)).OrderByDescending(l => l.UpdateAt).ToListAsync(); - List? noteVMs = new List(); - foreach (var note in notes) - { - DirectoryUpdateLog? noteUpdateLog = noteUpdateLogs.Where(n => n.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); - ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); - if (noteUpdateLog != null) - { - noteVM.UpdatedAt = noteUpdateLog.UpdateAt; - noteVM.UpdatedBy = noteUpdateLog.Employee != null ? noteUpdateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; - } - noteVMs.Add(noteVM); - } - contactVM.Notes = noteVMs; - } - _logger.LogInfo("Employee ID {EmployeeId} fetched profile of contact {COntactId}", LoggedInEmployee.Id, contact.Id); - return ApiResponse.SuccessResponse(contactVM, "Contact profile fetched successfully"); - - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); - } - public async Task> GetOrganizationList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - var organizationList = await _context.Contacts.Where(c => c.TenantId == tenantId).Select(c => c.Organization).Distinct().ToListAsync(); - _logger.LogInfo("Employee {EmployeeId} fetched list of organizations in a tenant {TenantId}", LoggedInEmployee.Id, tenantId); - return ApiResponse.SuccessResponse(organizationList, $"{organizationList.Count} records of organization names fetched from contacts", 200); - } - public async Task> DeleteContact(Guid id, bool active) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (id != Guid.Empty) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == tenantId); - if (contact == null) - { - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} tries to delete contact with ID {ContactId} is not found in database", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - contact.IsActive = active; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = contact.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - _logger.LogInfo("Contact {ContactId} has been deleted by Employee {Employee}", id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(new { }, "Contact is deleted Successfully", 200); - } - _logger.LogInfo("Employee ID {EmployeeId} sent an empty contact id", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Contact ID is empty", "Contact ID is empty", 400); - } - - // -------------------------------- Contact Notes -------------------------------- - - public async Task> GetNoteListByContactId(Guid id, bool active) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - List notes = new List(); - if (active) - { - notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive && n.TenantId == tenantId).ToListAsync(); - } - else - { - notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.TenantId == tenantId).ToListAsync(); - } - var noteIds = notes.Select(n => n.Id).ToList(); - List? updateLogs = await _context.DirectoryUpdateLogs.Include(l => l.Employee).Where(l => noteIds.Contains(l.RefereanceId)).ToListAsync(); - List? noteVMs = new List(); - foreach (var note in notes) - { - ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); - DirectoryUpdateLog? updateLog = updateLogs.Where(l => l.RefereanceId == note.Id).OrderByDescending(l => l.UpdateAt).FirstOrDefault(); - if (updateLog != null) - { - noteVM.UpdatedAt = updateLog.UpdateAt; - noteVM.UpdatedBy = updateLog.Employee != null ? updateLog.Employee.ToBasicEmployeeVMFromEmployee() : null; - } - else - { - noteVM.UpdatedAt = note.CreatedAt; - noteVM.UpdatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null; - } - noteVMs.Add(noteVM); - - } - _logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - public async Task> CreateContactNote(CreateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote note = noteDto.ToContactNoteFromCreateContactNoteDto(tenantId, LoggedInEmployee.Id); - _context.ContactNotes.Add(note); - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote(); - _logger.LogInfo("Employee {EmployeeId} Added note at contact {ContactId}", LoggedInEmployee.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note added successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to add a note to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - noteVM.UpdatedAt = DateTime.UtcNow; - noteVM.UpdatedBy = LoggedInEmployee.ToBasicEmployeeVMFromEmployee(); - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id, bool active) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); - if (note != null) - { - note.IsActive = active; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } - - - - - - // -------------------------------- Bucket -------------------------------- - - public async Task> GetBucketList() - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); - var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - - List employeeBuckets = await _context.EmployeeBucketMappings.Where(b => b.EmployeeId == LoggedInEmployee.Id).ToListAsync(); - var bucketIds = employeeBuckets.Select(b => b.BucketId).ToList(); - List employeeBucketVM = await _context.EmployeeBucketMappings.Where(b => bucketIds.Contains(b.BucketId)).ToListAsync(); - List bucketList = new List(); - if (permissionIds.Contains(directoryAdmin)) - { - bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => b.TenantId == tenantId).ToListAsync(); - } - else if (permissionIds.Contains(directoryManager) || permissionIds.Contains(directoryUser)) - { - bucketList = await _context.Buckets.Include(b => b.CreatedBy).Where(b => bucketIds.Contains(b.Id) || b.CreatedByID == LoggedInEmployee.Id).ToListAsync(); - } - else - { - _logger.LogError("Employee {EmployeeId} attemped to access a buckets list, but do not have permission", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); - } - - List bucketVMs = new List(); - if (bucketList.Any()) - { - bucketIds = bucketList.Select(b => b.Id).ToList(); - List? contactBucketMappings = await _context.ContactBucketMappings.Where(cb => bucketIds.Contains(cb.BucketId)).ToListAsync(); - foreach (var bucket in bucketList) - { - List employeeBucketMappings = employeeBucketVM.Where(eb => eb.BucketId == bucket.Id).ToList(); - var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); - List? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList(); - AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); - bucketVM.EmployeeIds = emplyeeIds; - bucketVM.NumberOfContacts = contactBuckets.Count; - bucketVMs.Add(bucketVM); - } - } - - _logger.LogInfo("{count} Buckets are fetched by Employee with ID {LoggedInEmployeeId}", bucketVMs.Count, LoggedInEmployee.Id); - return ApiResponse.SuccessResponse(bucketVMs, $"{bucketVMs.Count} buckets fetched successfully", 200); - } - public async Task> CreateBucket(CreateBucketDto bucketDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (bucketDto != null) - { - var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); - var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - var demo = !permissionIds.Contains(directoryUser); - if (!permissionIds.Contains(directoryAdmin) && !permissionIds.Contains(directoryManager) && !permissionIds.Contains(directoryUser)) - { - _logger.LogError("Employee {EmployeeId} attemped to create a bucket, but do not have permission", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("You don't have permission", "You don't have permission", 401); - } - - var existingBucket = await _context.Buckets.FirstOrDefaultAsync(b => b.Name == bucketDto.Name); - if (existingBucket != null) - { - _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing bucket.", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket already existed", "Bucket already existed", 409); - } - Bucket bucket = new Bucket - { - Name = bucketDto.Name, - Description = bucketDto.Description, - CreatedAt = DateTime.UtcNow, - CreatedByID = LoggedInEmployee.Id, - TenantId = tenantId - }; - _context.Buckets.Add(bucket); - - EmployeeBucketMapping employeeBucket = new EmployeeBucketMapping - { - EmployeeId = LoggedInEmployee.Id, - BucketId = bucket.Id - }; - - _context.EmployeeBucketMappings.Add(employeeBucket); - await _context.SaveChangesAsync(); - bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucket.Id) ?? new Bucket(); - BucketVM bucketVM = bucket.ToBucketVMFromBucket(); - _logger.LogInfo("Employee Id {LoggedInEmployeeId} creayted new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.SuccessResponse(bucketVM, "Bucket Created SuccessFully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> UpdateBucket(Guid id, UpdateBucketDto bucketDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (bucketDto != null && id == bucketDto.Id) - { - var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); - var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); - var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketDto.Id && b.TenantId == tenantId); - - if (bucket == null) - { - _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); - } - - Bucket? accessableBucket = null; - if (permissionIds.Contains(directoryAdmin)) - { - accessableBucket = bucket; - } - else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) - { - accessableBucket = bucket; - } - else if (permissionIds.Contains(directoryUser)) - { - if (bucket.CreatedByID == LoggedInEmployee.Id) - { - accessableBucket = bucket; - } - } - if (accessableBucket == null) - { - _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); - } - - bucket.Name = bucketDto.Name ?? ""; - bucket.Description = bucketDto.Description ?? ""; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = bucketDto.Id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - - AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); - List employeeBucketMappings = employeeBuckets.Where(eb => eb.BucketId == bucket.Id).ToList(); - List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); - var employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); - bucketVM.EmployeeIds = employeeIds; - bucketVM.NumberOfContacts = contactBuckets.Count; - - _logger.LogInfo("Employee Id {LoggedInEmployeeId} Updated new bucket {BucketId}", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.SuccessResponse(bucketVM, "Bucket update successFully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> AssignBucket(Guid bucketId, List assignBuckets) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (assignBuckets != null && bucketId != Guid.Empty) - { - var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); - var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - - Bucket? bucket = await _context.Buckets.Include(b => b.CreatedBy).FirstOrDefaultAsync(b => b.Id == bucketId && b.TenantId == tenantId); - - if (bucket == null) - { - _logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to update a bucket but not found in database.", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("Bucket not found", "Bucket not found", 404); - } - var employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucketId).ToListAsync(); - var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - var employeeBucketIds = employeeBuckets.Select(eb => eb.EmployeeId).ToList(); - Bucket? accessableBucket = null; - if (permissionIds.Contains(directoryAdmin)) - { - accessableBucket = bucket; - } - else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(bucketId)) - { - accessableBucket = bucket; - } - else if (permissionIds.Contains(directoryUser)) - { - if (bucket.CreatedByID == LoggedInEmployee.Id) - { - accessableBucket = bucket; - } - } - if (accessableBucket == null) - { - _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); - } - var employeeIds = await _context.Employees.Where(e => e.TenantId == tenantId && e.IsActive).Select(e => e.Id).ToListAsync(); - int assignedEmployee = 0; - int removededEmployee = 0; - foreach (var assignBucket in assignBuckets) - { - if (employeeIds.Contains(assignBucket.EmployeeId)) - { - if (assignBucket.IsActive && !employeeBucketIds.Contains(assignBucket.EmployeeId)) - { - EmployeeBucketMapping employeeBucketMapping = new EmployeeBucketMapping - { - EmployeeId = assignBucket.EmployeeId, - BucketId = bucketId - }; - _context.EmployeeBucketMappings.Add(employeeBucketMapping); - assignedEmployee += 1; - } - else - { - EmployeeBucketMapping? employeeBucketMapping = employeeBuckets.FirstOrDefault(eb => eb.BucketId == bucketId && eb.EmployeeId == assignBucket.EmployeeId); - if (employeeBucketMapping != null) - { - _context.EmployeeBucketMappings.Remove(employeeBucketMapping); - removededEmployee += 1; - } - } - } - } - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = bucketId, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - - AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket(); - List employeeBucketMappings = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); - List contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == bucket.Id).ToListAsync(); - employeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList(); - bucketVM.EmployeeIds = employeeIds; - bucketVM.NumberOfContacts = contactBuckets.Count; - - if (assignedEmployee > 0) - { - _logger.LogInfo("Employee {EmployeeId} assigned bucket {BucketId} to {conut} number of employees", LoggedInEmployee.Id, bucketId, assignedEmployee); - } - if (removededEmployee > 0) - { - _logger.LogError("Employee {EmployeeId} removed {conut} number of employees from bucket {BucketId}", LoggedInEmployee.Id, removededEmployee, bucketId); - } - return ApiResponse.SuccessResponse(bucketVM, "Details updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteBucket(Guid id) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - Bucket? bucket = await _context.Buckets.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenantId); - - if (bucket != null) - { - List? employeeBuckets = await _context.EmployeeBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); - List? contactBuckets = await _context.ContactBucketMappings.Where(eb => eb.BucketId == id).ToListAsync(); - - if (contactBuckets.Any()) - { - _logger.LogInfo("Employee {EmployeeId} attempted to deleted bucket {BucketId},but bucket have contacts in it.", LoggedInEmployee.Id, id); - return ApiResponse.ErrorResponse("This bucket can not be deleted", "This bucket can not be deleted", 400); - } - - var assignedRoleIds = await _context.EmployeeRoleMappings.Where(r => r.EmployeeId == LoggedInEmployee.Id).Select(r => r.RoleId).ToListAsync(); - var permissionIds = await _context.RolePermissionMappings.Where(rp => assignedRoleIds.Contains(rp.ApplicationRoleId)).Select(rp => rp.FeaturePermissionId).Distinct().ToListAsync(); - var bucketIds = employeeBuckets.Where(eb => eb.EmployeeId == LoggedInEmployee.Id).Select(eb => eb.BucketId).ToList(); - - Bucket? accessableBucket = null; - if (permissionIds.Contains(directoryAdmin)) - { - accessableBucket = bucket; - } - else if (permissionIds.Contains(directoryManager) && bucketIds.Contains(id)) - { - accessableBucket = bucket; - } - else if (permissionIds.Contains(directoryUser)) - { - if (bucket.CreatedByID == LoggedInEmployee.Id) - { - accessableBucket = bucket; - } - } - if (accessableBucket == null) - { - _logger.LogError("Employee {EmployeeId} attempted to access bucket {BucketId} without the necessary permissions.", LoggedInEmployee.Id, bucket.Id); - return ApiResponse.ErrorResponse("You don't have permission to access this bucket", "You don't have permission to access this bucket", 401); - } - - _context.EmployeeBucketMappings.RemoveRange(employeeBuckets); - _context.Buckets.Remove(bucket); - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted bucket {BucketId} and related entries", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete bucket {BucketId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Bucket deleted successfully", 200); - } - private bool Compare(string sentence, string search) - { - sentence = sentence.Trim().ToLower(); - search = search.Trim().ToLower(); - - // Check for exact substring - bool result = sentence.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; - return result; - } - - - public async Task> GetListOfContacts(string? search, bool active, ContactFilterDto? filterDto, Guid? projectId) { Guid tenantId = _userHelper.GetTenantId(); @@ -2337,186 +1018,6 @@ namespace Marco.Pms.Services.Helpers return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); } - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } - - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } - - public async Task> UpdateContactNote(Guid id, UpdateContactNoteDto noteDto) - { - Guid tenantId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (noteDto != null && id == noteDto.Id) - { - Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == noteDto.ContactId && c.IsActive && c.TenantId == tenantId); - if (contact != null) - { - ContactNote? contactNote = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == noteDto.Id && n.ContactId == contact.Id && n.IsActive); - if (contactNote != null) - { - contactNote.Note = noteDto.Note; - - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - - await _context.SaveChangesAsync(); - ContactNoteVM noteVM = contactNote.ToContactNoteVMFromContactNote(); - - - _logger.LogInfo("Employee {EmployeeId} updated note {NoteId} at contact {ContactId}", LoggedInEmployee.Id, noteVM.Id, contact.Id); - return ApiResponse.SuccessResponse(noteVM, "Note updated successfully", 200); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the Note was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Note not found", "Note not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to update a note {NoteId} to contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, noteDto.Id, noteDto.ContactId); - return ApiResponse.ErrorResponse("Contact not found", "Contact not found", 404); - } - _logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id); - return ApiResponse.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); - } - public async Task> DeleteContactNote(Guid id) - { - Guid tenentId = _userHelper.GetTenantId(); - var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - - ContactNote? note = await _context.ContactNotes.FirstOrDefaultAsync(n => n.Id == id && n.TenantId == tenentId); - if (note != null) - { - note.IsActive = false; - _context.DirectoryUpdateLogs.Add(new DirectoryUpdateLog - { - RefereanceId = id, - UpdatedById = LoggedInEmployee.Id, - UpdateAt = DateTime.UtcNow - }); - await _context.SaveChangesAsync(); - _logger.LogInfo("Employee {EmployeeId} deleted note {NoteId}", LoggedInEmployee.Id, id); - } - - _logger.LogWarning("Employee {EmployeeId} tries to delete contact note {NoteId} but not found in database", LoggedInEmployee.Id, id); - return ApiResponse.SuccessResponse(new { }, "Note deleted successfully", 200); - } - // -------------------------------- Bucket -------------------------------- public async Task> GetBucketList() diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 03f6d60..55883f6 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -143,6 +143,7 @@ namespace Marco.Pms.Services.Helpers _logger.LogWarning("Employee {EmployeeId} tries to delete Category {CategoryId} but not found in database", LoggedInEmployee.Id, id); return ApiResponse.SuccessResponse(new { }, "Category deleted successfully", 200); } + // -------------------------------- Contact Tag -------------------------------- -- 2.43.0 From 3f183713300d26c4739b4790496af83b5793de5c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 10 Jun 2025 16:52:01 +0530 Subject: [PATCH 469/469] FIxed issues invalid validation --- Marco.Pms.Services/Helpers/MasterHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index 55883f6..60d2385 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -190,7 +190,7 @@ namespace Marco.Pms.Services.Helpers { var tenantId = _userHelper.GetTenantId(); Employee LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); - if (contactTagDto != null && contactTagDto.Id != id) + if (contactTagDto != null && contactTagDto.Id == id) { ContactTagMaster? contactTag = await _context.ContactTagMasters.AsNoTracking().FirstOrDefaultAsync(t => t.TenantId == tenantId && t.Id == contactTagDto.Id); if (contactTag != null) -- 2.43.0