Skip to content

Conversation

epipav
Copy link
Collaborator

@epipav epipav commented Jun 27, 2023

Changes proposed ✍️

  • Querying for active members using opensearch
  • Member.query can now also filter by organization ids (fixes the problem in organization detail page where associated members were empty)

What

🤖 Generated by Copilot at 3a2c789

This pull request adds a feature to enable segment-based filtering and sorting for the active members list endpoint, which allows users to group and order members by their projects or subprojects. It also adds a utility script and a method to delete an OpenSearch index, a custom translation for the organizations field of the MembersOpensearch class, and a constant for the activities index. It also fixes a bug in the getDefaultSegment method and simplifies the query generation for the in operator. It modifies several files in the backend, services, and libs folders, such as memberRepository.ts, memberService.ts, memberActiveList.ts, segmentRepository.ts, package.json, opensearch.service.ts, members.ts, opensearchQueryParser.ts, and opensearch.ts.

🤖 Generated by Copilot at 3a2c789

To filter and sort by segments
We added some code and some flags
We used OpenSearch
And fixed a bug's crash
And added some scripts and some tags

Why

How

🤖 Generated by Copilot at 3a2c789

  • Add segment-based filtering and sorting feature for the active members list endpoint (link, link, link, link, link, link, link, link, link, link)
  • Use findAndCountActiveOpensearch method of MemberRepository to query and aggregate active members by segments, activity count, and active days count (link)
  • Use findAndCountAllOpensearch method of MemberRepository to fetch member details and join them with activity data (link, link, link, link, link)
  • Add customSortFunction parameter to findAndCountAllOpensearch method to allow script-based sorting for different scenarios (link, link)
  • Add segmentsEnabled variable to findAndCountAllOpensearch method to check feature flag and conditionally add segment filter (link, link)
  • Remove unused code from findAndCountAllOpensearch method (link)
  • Add segments parameter to findAndCountActive method of MemberService to filter active members by segments (link, link)
  • Add memberAttributeSettings variable to findAndCountActive method of MemberService to pass attribute settings to findAndCountActiveOpensearch method (link)
  • Add imports of isFeatureEnabled, FeatureFlag, and SegmentRepository to memberService.ts file (link)
  • Add segment validation and default segment logic to update method of MemberService (link)
    • Check feature flag and validate number of segments for member update (link)
    • Assign default segment if feature flag is not enabled (link)
  • Fix bug in getDefaultSegment method of SegmentRepository (link)
    • Add limit and offset parameters to querySubprojects method call (link)
  • Add utility script to delete OpenSearch index (link, link)
    • Add script:delete-index command to package.json file of search_sync_worker service (link)
    • Add deleteIndex method to OpenSearchService class in opensearch.service.ts file (link)
  • Add custom translation for organizations field of MembersOpensearch class (link)
    • Define customTranslation object with toOpensearch and fromOpensearch properties for organizations field (link)
  • Simplify query generation for in operator in OpensearchQueryParser class (link)
    • Replace bool query with should clause with terms query for parseIn method (link)
  • Add constant for activities index to OpenSearchIndex enum (link)
    • Add ACTIVITIES value to OpenSearchIndex enum in opensearch.ts file (link)

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screehshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

@epipav epipav marked this pull request as ready for review June 27, 2023 12:57
@epipav epipav self-assigned this Jun 27, 2023
@epipav epipav added the Feature Created by Linear-GitHub Sync label Jun 27, 2023
@epipav epipav merged commit a761aee into main Jun 27, 2023
@epipav epipav deleted the feature/opensearch-active-members branch June 27, 2023 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants