Activity Approval Service
Component Detail
Service Layer
medium complexity
backend
2
Dependencies
2
Dependents
3
Entities
0
Integrations
Description
Backend REST endpoint handler managing activity status transitions from pending to approved or returned. Enforces tenant scoping and role guards so only Coordinators and Org Admins within the correct organization may approve; Global Admins receive read-only access. Every successful transition writes to the activities table and appends an audit entry.
activity-approval-service
Responsibilities
- Validate requester role and tenant scope before processing any status transition
- Transition activity status from pending to approved, writing confirmation timestamp
- Transition activity status from pending to returned, persisting the correction note
- Support batch endpoint accepting an array of activity IDs for high-volume coordinators
- Append an audit_logs entry for every individual status change including actor, timestamp, and action
Interfaces
POST /api/v1/activities/:id/approve
POST /api/v1/activities/:id/return
POST /api/v1/activities/batch-approve
POST /api/v1/activities/batch-return
approveActivity(activityId: string, actorId: string): Activity
returnActivity(activityId: string, actorId: string, note: string): Activity
batchApprove(activityIds: string[], actorId: string): BatchResult
batchReturn(activityIds: string[], actorId: string, note: string): BatchResult
Relationships
Dependencies (2)
Components this component depends on
Dependents (2)
Components that depend on this component
Related Data Entities (3)
Data entities managed by this component