MemberAssociationService
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
5
Entities
0
Integrations
Description
Business logic layer for managing user-to-association relationships. Enforces the five-association cap, handles primary association assignment, and ensures membership changes propagate correctly to activity roll-up and reporting pipelines.
member-association-service
Sources & reasoning
Line 107 directly requires handling users in up to five local associations simultaneously with double-reporting prevention. This membership model is a prerequisite for the hierarchy roll-up and Bufdir attribution logic. Since NHF is a Phase 1 launch organization, and this data feeds the MVP reporting pipeline, it is classified MVP.
-
docs/source/likeperson.md · line 107Håndtering av medlemmer i flere lokallag (opptil 5): Avklare tilhørighet og hindre dobbeltrapportering.
Responsibilities
- Validate that a user does not exceed five concurrent association memberships
- Assign or remove association memberships and persist changes
- Enforce single primary association per user and update it on request
- Emit events on membership changes to trigger activity roll-up recalculation
- Provide membership data to downstream Bufdir reporting consumers
Interfaces
getUserMemberships(userId: string): AssociationMembership[]
assignMembership(userId: string, associationId: string): AssociationMembership
removeMembership(userId: string, associationId: string): void
setPrimary(userId: string, associationId: string): AssociationMembership
validateMembershipLimit(userId: string): boolean
Related Data Entities (5)
Data entities managed by this component