Service Layer medium complexity backend
1
Dependencies
3
Dependents
1
Entities
0
Integrations

Description

REST service that handles manual and automated flag lifecycle operations on activity records. Exposes PATCH endpoints for flagging and unflagging, enforces that flagged activities are excluded from statistics and Bufdir aggregation queries, and writes actor and action metadata to audit_logs on every state change.

Feature: Activity Flagging

activity-flag-service

Responsibilities

  • Process manual PATCH /activities/:id/flag and /activities/:id/unflag requests
  • Enforce role-based authorization - coordinators and admins only
  • Ensure flagged activities are filtered out of aggregation queries for statistics and Bufdir reporting
  • Write structured audit_log entries for every flag create, resolve, and dismiss action
  • Return paginated list of flagged activities scoped to the requesting user's organization

Interfaces

flagActivity(activityId: string, reason: string, actorId: string): Promise<FlagRecord>
unflagActivity(activityId: string, actorId: string): Promise<void>
resolveFlag(flagId: string, resolution: FlagResolution, actorId: string): Promise<void>
dismissFlag(flagId: string, actorId: string): Promise<void>
getFlaggedActivities(orgId: string, page: number): Promise<FlaggedActivityPage>
getActivityFlagStatus(activityId: string): Promise<FlagStatus | null>

Relationships

Dependencies (1)

Components this component depends on

Dependents (3)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component