Skip to content

PM-5073 - Allow search by preferred roles, remove restriction about skills#105

Merged
vas3a merged 1 commit into
developfrom
PM-5073_talent-search
Jun 15, 2026
Merged

PM-5073 - Allow search by preferred roles, remove restriction about skills#105
vas3a merged 1 commit into
developfrom
PM-5073_talent-search

Conversation

@vas3a

@vas3a vas3a commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

This pull request enhances the member search functionality by adding support for filtering and sorting members based on their preferred roles, as specified in their open-to-work personalization trait. The changes include updates to the API DTO, query normalization, SQL filtering, and ordering logic to ensure accurate and relevant search results.

Preferred Roles Filtering and Sorting:

  • Added a new optional preferredRoles array property to the MemberSearchBodyDto to allow filtering members by their preferred roles from the open-to-work personalization trait.
  • Updated the MemberSearchService to accept the preferredRoles parameter and normalize its values for consistent processing. [1] [2]
  • Enhanced the SQL query to filter members whose open-to-work personalization trait contains any of the specified preferred roles, ensuring case-insensitive matching.

Ordering Improvements:

  • Modified the result ordering logic to prioritize recently active users and those available for gigs when only preferredRoles filtering is applied and no skills are specified; otherwise, default ordering by match index and handle is used.
  • Adjusted SQL LEFT JOIN logic to only join user_match_data when skill filters are present, optimizing query performance.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the member search API to support filtering members by their open-to-work preferred roles, and adjusts query ordering/performance when searching without skills.

Changes:

  • Adds preferredRoles?: string[] to MemberSearchBodyDto for API-level filtering.
  • Updates MemberSearchService SQL generation to filter on openToWork.preferredRoles (JSONB) with case-insensitive matching.
  • Changes ordering to prioritize recently active and available-for-gigs members when searching by preferred roles without skills, and avoids joining user_match_data unless skills are provided.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/reports/member/member-search.service.ts Normalizes preferredRoles, adds JSONB preferred-role filtering, adjusts ORDER BY behavior, and makes user_match_data join conditional.
src/reports/member/dto/member-search.dto.ts Adds preferredRoles to the request DTO with Swagger + validation decorators.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +229 to +235
const normalizedPreferredRoles = Array.isArray(preferredRoles)
? [
...new Set(
preferredRoles.map((value) => String(value).trim()).filter(Boolean),
),
]
: [];
Comment on lines +248 to +252
if (normalizedPreferredRoles.length > 0) {
const pPreferredRoles = p(
normalizedPreferredRoles.map((value) => value.toUpperCase()),
);
where.push(
@vas3a vas3a merged commit 7ed909f into develop Jun 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants