MemberAssociationService
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations
Description
Handles all business logic and data persistence for user-to-organization membership records. Enforces access control rules, manages overlapping memberships across multiple local branches, and coordinates the invitation flow that adds users without self-registration.
member-association-service
Sources & reasoning
The invitation and membership management model is described as a core admin portal capability (line 186-189), and NHF's multi-branch membership problem (line 107) requires explicit membership association management to prevent double-reporting. Blueprint assigns MVP, consistent with admin portal MVP scope for user management and org settings.
-
docs/source/likeperson.md · line 107Håndtering av medlemmer i flere lokallag (opptil 5): Avklare tilhørighet og hindre dobbeltrapportering.
-
docs/source/likeperson.md · line 186-189Coordinators and Peer Mentors are **managed** inside the admin portal (invitations, role assignment, deactivation) but never log in to it - they only log in to the Mobile App.
Responsibilities
- Create, update, and delete membership records with validation against the org hierarchy
- Enforce role-based access so only Org Admins can mutate memberships within their scope
- Manage overlapping memberships and enforce uniqueness of primary org node per user
- Execute bulk membership operations atomically and return per-record success or failure status
- Generate and process invitations, creating pending membership records and notifying invitees
Interfaces
getMemberships(orgNodeId, filters): MembershipRecord[]
createMembership(actorId, userId, orgNodeId, roleId): MembershipRecord
setPrimaryNode(actorId, userId, orgNodeId): MembershipRecord
removeMembership(actorId, membershipId): void
bulkAssign(actorId, userIds, orgNodeId, roleId): BulkResult
inviteUser(actorId, email, orgNodeId, roleId): Invitation
acceptInvitation(token): MembershipRecord
Related Data Entities (3)
Data entities managed by this component