feat: deactivateOrg to work with tenant code#791
feat: deactivateOrg to work with tenant code#791nevil-mathew wants to merge 2 commits intodevelopfrom
Conversation
✅ Actions performedReview triggered.
|
|
Caution Review failedThe pull request is closed. WalkthroughThe admin controller now extracts tenant-id and adminId and calls adminService.deactivateOrg with (orgId/code, tenantId, adminId). The service changes to deactivate organizations by organizationCode and tenantCode, deactivates users via a helper, conditionally removes sessions, and broadcasts events. JSDocs and logging were updated. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AdminController
participant AdminService
participant OrgStore as Org DB
participant UserHelper
participant SessionHelper
participant EventBus
Client->>AdminController: DELETE /v1/admin/orgs/:id (tenant-id)
AdminController->>AdminService: deactivateOrg(orgId/code, tenantId, adminId)
AdminService->>OrgStore: UPDATE organization SET status=INACTIVE WHERE code & tenant_code
AdminService->>UserHelper: deactivateUserInOrg(orgCode, tenantCode)
UserHelper-->>AdminService: {rowsAffected, updatedUsers}
alt rowsAffected > 0
AdminService->>SessionHelper: removeAllUserSessions(userIds)
AdminService->>EventBus: broadcast(deactivateUpcomingSession, userIds)
end
AdminService-->>AdminController: {deactivated_users, org}
AdminController-->>Client: 200 OK
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
Summary by CodeRabbit
New Features
Bug Fixes
Chores