ActivityFlaggingService
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Business logic layer that manages the full lifecycle of activity flags including creation, categorisation, and resolution. Enforces role-based access so only coordinators and administrators may create or resolve flags. Routes flagged activities into the review queue and emits notifications when new flags are raised.
activity-flagging-service
Sources & reasoning
Line 330 establishes Aktivitetsoversikt as the MVP admin capability. Flagging is an enhancement beyond basic review, needed for the organizational scale described in line 109. It is not listed in the Phase 1 MVP admin scope so Phase 2 ordinal applies, mapping to v1.0.
-
docs/source/likeperson.md · line 330- Aktivitetsoversikt og grunnleggende statistikk
-
docs/source/likeperson.md · line 109- **Bredest organisasjonsstruktur:** 12 landsforeninger, 9 regioner, 1 400 lokallag - aktivitetsfordeling mellom ledd må støttes.
Responsibilities
- Create and persist flags with validated category and ownership metadata
- Enforce role authorisation before any flag mutation
- Query and return the review queue filtered by organisation scope and flag category
- Resolve or dismiss flags and record audit trail entries
- Publish flag-created events for downstream notification services
Interfaces
createFlag(activityId: string, flagType: FlagType, notes: string, raisedBy: string): Promise<Flag>
resolveFlag(flagId: string, resolution: FlagResolution, resolvedBy: string): Promise<Flag>
getFlagsByActivity(activityId: string): Promise<Flag[]>
getReviewQueue(orgId: string, filters: FlagQueueFilters): Promise<PagedResult<Flag>>
deleteFlag(flagId: string, requestedBy: string): Promise<void>