Skip to content

fix: allow empty affiliations array in PATCH project affiliations#3946

Merged
skwowet merged 2 commits intomainfrom
bugfix/affiliations-patch-endpoint
Mar 23, 2026
Merged

fix: allow empty affiliations array in PATCH project affiliations#3946
skwowet merged 2 commits intomainfrom
bugfix/affiliations-patch-endpoint

Conversation

@skwowet
Copy link
Collaborator

@skwowet skwowet commented Mar 23, 2026

Summary

  • Allow empty affiliations array in PATCH /members/:memberId/project-affiliations/:projectId to support removing all project affiliations
  • Make verifiedBy optional when clearing affiliations (still required when adding)

Note

Low Risk
Low risk validation and persistence tweak confined to a single PATCH endpoint; main risk is client behavior changes when sending empty arrays and ensuring recalculation still behaves as expected.

Overview
Updates PATCH /members/:memberId/project-affiliations/:projectId to support clearing all affiliations by allowing an empty affiliations array.

Makes verifiedBy optional only when affiliations is empty (enforced via a schema refine), and skips insertMemberSegmentAffiliations when no affiliations are provided while still deleting existing rows and triggering recalculation.

Written by Cursor Bugbot for commit 34acf97. This will update automatically on new commits. Configure here.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Mar 23, 2026
Copilot AI review requested due to automatic review settings March 23, 2026 12:45
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

2 similar comments
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link
Contributor

Copilot AI left a comment

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 updates the public members API PATCH handler for project affiliations to support clearing all affiliations by accepting an empty affiliations array, while only requiring verifiedBy when actually adding affiliations.

Changes:

  • Allow affiliations: [] in the request body (removes the previous .min(1) constraint).
  • Make verifiedBy optional in the schema, and enforce it conditionally when affiliations is non-empty.
  • Skip inserting rows when clearing affiliations, while still deleting existing affiliations and triggering recalculation.

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

…ojectAffiliation.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@skwowet skwowet merged commit 219d64b into main Mar 23, 2026
9 checks passed
@skwowet skwowet deleted the bugfix/affiliations-patch-endpoint branch March 23, 2026 12:58
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