Bulk Action Service
Component Detail
Service Layer
high complexity
backend
4
Dependencies
2
Dependents
3
Entities
0
Integrations
Description
Server-side batch endpoint handler (POST /api/v1/users/bulk) that accepts an array of user IDs and an action descriptor. Validates each user ID against the requesting admin's organization tenancy boundary, applies the action within a single database transaction for atomicity, records each individual operation in the audit log, and delegates to the sessions service for bulk deactivation. Processes asynchronously and returns a job ID when the selection exceeds 20 users.
bulk-action-service
Responsibilities
- Validate all user IDs against requesting admin's organization before processing
- Execute bulk role assignment reusing role-assignment validation logic in a single transaction
- Trigger session invalidation via sessions service for each deactivated user
- Dispatch async job for selections over 20 users and expose status polling endpoint
- Write individual audit log entry per record in the batch regardless of outcome
Interfaces
bulkExecute(adminId: string, orgId: string, userIds: string[], action: BulkActionType, params: BulkActionParams): Promise<BulkOperationResult | BulkJobRef>
getJobStatus(jobId: string, adminId: string): Promise<BulkJobStatus>
validateTenancy(orgId: string, userIds: string[]): Promise<TenancyValidationResult>
bulkAssignRole(userIds: string[], roleId: string, orgId: string): Promise<BatchResult>
bulkDeactivate(userIds: string[], orgId: string): Promise<BatchResult>
bulkResendInvitation(userIds: string[], orgId: string): Promise<BatchResult>
Relationships
Dependencies (4)
Components this component depends on
Dependents (2)
Components that depend on this component
Related Data Entities (3)
Data entities managed by this component