Implemented filtering functionality for Get Contact List API #67

Merged
vikas.nale merged 1 commits from AshutoshEnhancement#332_Added_Filter_To_Contact_List into Feature_Directory 2025-05-22 13:19:27 +00:00
Collaborator
  • Get Tenant and Employee Info:
    • Retrieve the current tenant ID using _userHelper.GetTenantId().
    • Get the currently logged-in employee using _userHelper.GetCurrentEmployeeAsync().
  • Get Employee's Buckets:
    • Fetch all EmployeeBucketMappings related to the employee.
    • Extract all BucketIds from these mappings.
  • Apply Bucket Filter (if provided):
    • If filterDto.BucketIds is specified, override the employee's buckets with the filtered ones.
  • Find Related Contacts:
    • Use the final bucketIds to get all ContactBucketMappings.
    • Extract ContactIds from these mappings to identify relevant contacts.
  • Apply Category Filter (if provided):
    • If filterDto.CategoryIds is given, only include contacts that belong to the selected categories.
    • Otherwise, include all contacts from the given buckets that are active and match the tenant.
  • Load Related Data:
    • Fetch contact phone numbers, emails, tags, and project mappings from the database.
    • Also fetch the tag details from ContactTagMasters.
  • Apply Search Filter (if provided):
    • If a search string is provided:
      • Filter contacts by matching phone number or email address.
      • Further filter contacts by name or organization.
      • Combine all matching ContactIds and apply filtering to the contacts list.
  • Build View Models (ContactVM):
    • For each contact:
      • Map phone numbers to ContactPhoneVM
      • Map emails to ContactEmailVM
      • Map tag mappings to ContactTagVM using tag metadata
      • Collect associated project and bucket IDs
      • Compose a full ContactVM with all this data
  • Logging and Response:
    • Log the number of contacts fetched and the employee ID.
    • Return a success response with the list of ContactVMs and a success message.
- **Get Tenant and Employee Info**: - Retrieve the current tenant ID using _userHelper.GetTenantId(). - Get the currently logged-in employee using _userHelper.GetCurrentEmployeeAsync(). - **Get Employee's Buckets**: - Fetch all EmployeeBucketMappings related to the employee. - Extract all BucketIds from these mappings. - **Apply Bucket Filter (if provided)**: - If filterDto.BucketIds is specified, override the employee's buckets with the filtered ones. - **Find Related Contacts**: - Use the final bucketIds to get all ContactBucketMappings. - Extract ContactIds from these mappings to identify relevant contacts. - **Apply Category Filter (if provided)**: - If filterDto.CategoryIds is given, only include contacts that belong to the selected categories. - Otherwise, include all contacts from the given buckets that are active and match the tenant. - **Load Related Data**: - Fetch contact phone numbers, emails, tags, and project mappings from the database. - Also fetch the tag details from ContactTagMasters. - **Apply Search Filter (if provided)**: - If a search string is provided: - Filter contacts by matching phone number or email address. - Further filter contacts by name or organization. - Combine all matching ContactIds and apply filtering to the contacts list. - **Build View Models (ContactVM)**: - For each contact: - Map phone numbers to ContactPhoneVM - Map emails to ContactEmailVM - Map tag mappings to ContactTagVM using tag metadata - Collect associated project and bucket IDs - Compose a full ContactVM with all this data - **Logging and Response**: - Log the number of contacts fetched and the employee ID. - Return a success response with the list of ContactVMs and a success message.
ashutosh.nehete added 1 commit 2025-05-22 11:57:52 +00:00
vikas.nale merged commit e0af0b5ba3 into Feature_Directory 2025-05-22 13:19:27 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/marco.pms.api#67
No description provided.