Skip to content

PM-6440 - ensure users are active before assigning them as managers - #61

Merged
vas3a merged 3 commits into
developfrom
PM-6438_get-managers-update-access
Sep 28, 2026
Merged

vas3a merged 3 commits into
developfrom
PM-6438_get-managers-update-access

Conversation

@vas3a

@vas3a vas3a commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

This pull request adds validation to prevent inactive users from being assigned as engagement managers and introduces supporting tests and methods. The main changes include updating error messages, adding a method to check member activity, and integrating this validation into the assignment flow.

Validation and Error Handling:

  • Added a new error message ManagerInactive to ERROR_MESSAGES to indicate that inactive members cannot be assigned as managers.
  • In EngagementManagersService, before assigning a manager, now checks if the user is active using the new isMemberActiveByUserId method. Throws a BadRequestException with the new error message if the user is inactive.

Member Service Enhancements:

  • Added status and active fields to the MemberRecord type and implemented the isMemberActiveByUserId method in MemberService to determine if a member is active, handling legacy payloads gracefully. [1] [2]

Testing Improvements:

  • Updated the EngagementManagersService tests to mock and verify the new isMemberActiveByUserId method, including a test case to ensure inactive users are rejected. [1] [2] [3]

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.

Copilot review overview

🟡 Changes recommended

There are correctness/documentation and test-specificity issues to address before the change is reliably validated and accurately documented.

Review effort: Lite
Findings: 3 Low severity

Open (3)
What changed in this PR

This PR adds a validation step to prevent assigning inactive Topcoder members as engagement managers, by introducing a member-activity lookup in MemberService and enforcing it during the manager assignment flow.

Changes:

  • Added MemberService.isMemberActiveByUserId() to evaluate member activity based on member status.
  • Enforced an “inactive manager” rejection in EngagementManagersService during identity resolution.
  • Extended manager assignment tests to mock/cover the new activity check and added a new error message constant.
File Description
src/​integrations/​member.service.ts Adds status to MemberRecord and introduces isMemberActiveByUserId() based on member status.
src/​engagements/​managers/​engagement-managers.service.ts Calls isMemberActiveByUserId() before allowing manager assignment; rejects inactive members.
src/​engagements/​managers/​engagement-managers.service.spec.ts Updates mocks for the new method and adds a test case for inactive-member rejection.
src/​common/​constants.ts Adds ERROR_MESSAGES.ManagerInactive for the new validation failure.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/engagements/managers/engagement-managers.service.spec.ts Outdated
Comment thread src/engagements/managers/engagement-managers.service.ts
Comment thread src/integrations/member.service.ts
@vas3a
vas3a merged commit 2cb58d2 into develop Sep 28, 2026
2 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