Conversation
…ns row is deleted Signed-off-by: Uroš Marolt <uros@marolt.me>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
2 similar comments
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Pull request overview
This PR adds a cleanup step to remove stale manual project affiliation overrides (“memberSegmentAffiliations”) when a member’s last work experience for a given organization is deleted.
Changes:
- Added a DAL helper to delete memberSegmentAffiliations for a member+org only when no active memberOrganizations rows remain for that org.
- Invoked that cleanup helper during the public API flow that deletes a work experience.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| services/libs/data-access-layer/src/members/projectAffiliations.ts | Adds cleanupMemberSegmentAffiliationsForOrg to conditionally purge segment affiliation overrides when the last active org affiliation is gone. |
| backend/src/api/public/v1/members/work-experiences/deleteMemberWorkExperience.ts | Calls the new cleanup helper after deleting a work experience and before triggering affiliation recalculation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
backend/src/api/public/v1/members/work-experiences/deleteMemberWorkExperience.ts
Outdated
Show resolved
Hide resolved
services/libs/data-access-layer/src/members/projectAffiliations.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Uroš Marolt <uros@marolt.me>
…rganizations-delete
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
joanagmaia
left a comment
There was a problem hiding this comment.
Left one comment, but for the API issue looks good
Signed-off-by: Uroš Marolt <uros@marolt.me>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
Signed-off-by: Uroš Marolt <uros@marolt.me>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |

Note
Medium Risk
Touches transactional delete logic across multiple tables and adds new cleanup deletes, which could unintentionally remove affiliations if the conditions are wrong. Impact is limited to member/org affiliation data and is wrapped in a DB transaction.
Overview
Ensures deleting member work experiences/organizations also removes stale
memberSegmentAffiliationsfor organizations where the member no longer has any non-deletedmemberOrganizationsrows.deleteMemberOrganizationsnow captures affectedorganizationIds before the delete, deletes any relatedmemberOrganizationAffiliationOverrides, performs the soft/hard delete, and then deletes segment affiliations that no longer have an active work-experience backing them. The profiles worker’sremoveMemberOrganizationscall is updated to soft-delete member org rows (instead of hard-deleting) so this cleanup runs consistently.Written by Cursor Bugbot for commit 3c4a7f7. This will update automatically on new commits. Configure here.