-
Notifications
You must be signed in to change notification settings - Fork 11
feat(routes): add remove user from congregation for admin #1645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new controller function and corresponding route were introduced to allow administrators to remove a user's association with a congregation. The controller validates the user, removes their congregation link, refreshes related data, and returns the updated user list. The route is exposed as a DELETE endpoint under the admin API. Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin User
participant API as Admin API (DELETE /users/:id/congregation)
participant Controller as userRemoveCongregation
participant DB as Database
Admin->>API: DELETE /users/:id/congregation
API->>Controller: Invoke userRemoveCongregation(req, res)
Controller->>DB: Find user by ID
alt User not found
Controller->>API: Return 404 Not Found
else User found
Controller->>DB: Remove user's congregation association
Controller->>DB: Reload congregation members (if applicable)
Controller->>DB: Fetch updated user list
Controller->>API: Return 200 OK with updated data
end
Possibly related PRs
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/v3/controllers/admin_controller.ts
(1 hunks)src/v3/routes/admin.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/v3/routes/admin.ts (1)
src/v3/controllers/admin_controller.ts (1)
userRemoveCongregation
(837-874)
🔇 Additional comments (2)
src/v3/controllers/admin_controller.ts (1)
837-874
: Implementation looks solid and follows established patterns.The new
userRemoveCongregation
function is well-implemented and consistent with other user management functions in the controller. The logic flow is correct:
- Validates user ID parameter
- Finds and validates user existence
- Captures congregation ID before removal
- Removes congregation association
- Reloads congregation members if applicable
- Returns updated user list
The error handling and response format are consistent with the existing codebase.
src/v3/routes/admin.ts (1)
26-26
: Import addition is correct.The import for
userRemoveCongregation
is properly added and maintains alphabetical order in the import list.
🎉 This PR is included in version 3.27.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.