core PK: id 9 required 1 unique

Description

Represents individuals receiving peer mentor support within the Meander platform. Each contact record stores personal details, organizational affiliation, assigned peer mentor, and serves as the central reference point linking activities, notes, assignments, caregivers, and expense records. Contacts are scoped to organizations and filtered by local association membership for role-based access control.

24
Attributes
8
Indexes
10
Validation Rules
39
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Unique identifier for the contact record
PKrequiredunique
organization_id uuid Foreign key to the organization this contact belongs to, enforcing multi-tenant data isolation
required
local_association_id uuid Foreign key to the local association within the organization hierarchy that manages this contact
-
assigned_peer_mentor_id uuid Foreign key to the user (peer mentor) currently assigned to support this contact
-
first_name string Contact's given name
required
last_name string Contact's family name
required
phone string Primary phone number in E.164 or Norwegian format
-
email string Email address for the contact
-
address_street string Street address line
-
address_postal_code string Norwegian postal code (postnummer)
-
address_city string City or municipality name
-
date_of_birth datetime Contact's date of birth, used for demographic reporting and age-appropriate service matching
-
gender enum Contact's gender for demographic reporting to Bufdir
-
status enum Current lifecycle status of the contact within the peer mentor program
required
notes_text text Free-text general notes about the contact visible to assigned peer mentor and coordinator
-
tags json Array of string tags for categorization and filtering (e.g. support type, needs)
-
preferred_language string Preferred communication language (ISO 639-1 code, e.g. 'nb' for Norwegian Bokmål, 'se' for Northern Sami)
-
preferred_contact_method enum How the contact prefers to be reached by their peer mentor
-
sensitivity_level enum Data sensitivity classification for screen reader warning system and access control
required
source enum How this contact was added to the system
-
created_by uuid User ID of the person who created this contact record
required
created_at datetime Timestamp when the contact record was created
required
updated_at datetime Timestamp of the last modification to the contact record
required
deleted_at datetime Soft-delete timestamp; non-null indicates the record is logically deleted for GDPR compliance
-

Database Indexes

idx_contacts_organization
btree

Columns: organization_id

idx_contacts_local_association
btree

Columns: organization_id, local_association_id

idx_contacts_assigned_mentor
btree

Columns: assigned_peer_mentor_id

idx_contacts_status
btree

Columns: organization_id, status

idx_contacts_name_search
btree

Columns: organization_id, last_name, first_name

idx_contacts_created_at
btree

Columns: organization_id, created_at

idx_contacts_soft_delete
btree

Columns: deleted_at

idx_contacts_fulltext
gin

Columns: first_name, last_name, email, phone

Validation Rules

required_name_fields error

Validation failed

valid_phone_format error

Validation failed

valid_email_format error

Validation failed

valid_postal_code warning

Validation failed

date_of_birth_in_past error

Validation failed

organization_id_exists error

Validation failed

local_association_within_organization error

Validation failed

status_transition_validity error

Validation failed

tags_json_array_format error

Validation failed

at_least_one_contact_method warning

Validation failed

Business Rules

organization_scoped_access
always

All contact queries must be scoped to the requesting user's organization_id extracted from JWT claims. No cross-organization contact access is permitted except for Global Admins performing system operations.

local_association_visibility
always

Peer mentors can only view contacts assigned to them. Coordinators can view all contacts within their local association scope. Org Admins can view all contacts within the organization.

assigned_mentor_must_be_valid
on_create

The assigned_peer_mentor_id must reference a user with the Peer Mentor role within the same organization. Coordinators may reassign contacts to different peer mentors within their local association.

soft_delete_for_gdpr
on_delete

Contacts are never hard-deleted. Deletion sets deleted_at timestamp and redacts PII fields after a configurable retention period. This preserves referential integrity for activities, notes, and Bufdir reporting history.

prevent_duplicate_contacts
on_create

Within the same organization, warn when creating a contact with matching first_name + last_name + phone or first_name + last_name + date_of_birth to prevent duplicate records across local associations (NHF requirement for handling members in up to 5 local associations).

cascade_status_to_assignments
on_update

When a contact's status changes to archived or inactive, all open assignments linked to this contact should be flagged for coordinator review. Active activities should not be retroactively affected.

audit_all_modifications
always

Every create, update, and delete operation on contact records must produce an audit log entry capturing the actor, timestamp, changed fields, and organization context.

sensitive_field_readout_protection
always

Fields marked in the organization's sensitive field configuration (address, date_of_birth, phone) must trigger a screen reader warning before being read aloud, per NHF accessibility requirement.

offline_sync_conflict_resolution
on_update

When contacts are edited offline on multiple devices, server timestamp wins. The most recent server-confirmed update takes precedence, and local changes are queued for re-application if they do not conflict on the same fields.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage

Components Managing This Entity

data Permission Store ["mobile"] data Permission Store ["mobile","backend"] service Role Guard Service ["mobile"] service Role Guard Service ["mobile","backend"] service Activity Service ["mobile"] service Activity Service ["mobile"] ui Quick Log Widget ["mobile"] ui Quick Log Widget ["mobile"] service Activity Service ["mobile"] service Proxy Registration Service ["mobile"] service Proxy Registration Service ["mobile","backend"] ui Proxy Registration Screen ["mobile"] ui Proxy Registration Screen ["mobile"] service Bulk Processing Service ["mobile"] service Bulk Processing Service ["backend"] service Bulk Validation Service ["backend"] ui Bulk Upload Screen ["mobile"] ui Bulk Upload Screen ["mobile"] data Contact Store ["mobile"] data Contact Store ["mobile"] service Contact Service ["mobile"] service Contact Service ["mobile"] ui Contact Search Widget ["mobile"] ui Contact Search Widget ["mobile"] ui Contacts List Screen ["mobile"] ui Contacts List Screen ["mobile"] data Contact Store ["mobile"] service Contact Update Service ["mobile"] service Contact Update Service ["mobile"] ui Contact Detail Screen ["mobile"] ui Contact Detail Screen ["mobile"] ui Contact Edit Screen ["mobile"] ui Contact Edit Screen ["mobile"] ui Notes List Screen ["mobile"] ui Notes List Screen ["mobile"] ui Contact Search Widget ["mobile"] ui Note Editor Screen ["mobile"] ui Note Editor Screen ["mobile"] service Stats Aggregation Service ["backend"] service Stats Aggregation Service ["backend","mobile"] data Assignment Store ["backend","mobile"] data Assignment Store ["mobile","backend"] ui Assignment Detail Screen ["mobile"] ui Assignment Detail Screen ["mobile"] service Notification Rule Engine ["backend"] service Notification Rule Engine ["backend"] service Readout Warning Service ["mobile"] service Readout Warning Service ["mobile"] ui Sensitive Field Widget ["mobile"] ui Sensitive Field Widget ["mobile"] service Dashboard Service ["mobile"] service Dashboard Service ["mobile"] data Local SQLite Database ["mobile"] data Local SQLite Database ["mobile"] data Sync Queue ["mobile"] data Sync Queue ["mobile"] service Offline Manager ["mobile"] service Offline Manager ["mobile"] service Background Sync Service ["mobile"] service Background Sync Service ["mobile"] service Activity Feed Service ["backend"] service Activity Feed Service ["backend"] ui Activity Feed Component ["frontend"] ui Activity Feed Component ["frontend"] service User Service ["backend"] service User Service ["backend"] service Audit Log Service ["backend"] service Audit Log Service ["backend"] service Custom Report Service ["backend"] service Custom Report Service ["backend"] service Audit Log Service ["backend"] service Audit Log Service ["backend"]