Activity Approval Service
Component Detail
Service Layer
medium complexity
backend
1
Dependencies
1
Dependents
3
Entities
0
Integrations
Description
Backend service that owns the approval workflow state machine for activity registrations. Handles status transitions from pending to approved or rejected, persisting updated_by and reviewed_at audit metadata. Exposes REST endpoints consumed by the Next.js admin portal (SSR) and the Flutter mobile app for read-only status reflection.
activity-approval-service
Responsibilities
- Transition activity status (pending to approved or rejected) with authorization checks
- Persist updated_by and reviewed_at fields on every status change
- Enforce role-based authorization - coordinator and org-admin roles only
- Support bulk approval for multiple activity IDs within a single request
- Emit an audit log entry via Audit Service on every status change
Interfaces
approveActivity(activityId: string, reviewerId: string): Promise<Activity>
rejectActivity(activityId: string, reviewerId: string, reason?: string): Promise<Activity>
bulkApprove(activityIds: string[], reviewerId: string): Promise<BulkApprovalResult>
getApprovalHistory(activityId: string): Promise<ApprovalEvent[]>
getPendingCount(organizationId: string): Promise<number>
Relationships
Related Data Entities (3)
Data entities managed by this component