core PK: id 10 required 2 unique

Description

Lightweight free-text notes captured by peer mentors and coordinators, optionally linked to a contact, used to record observations and follow-up reminders outside of formal activity reports.

15
Attributes
5
Indexes
6
Validation Rules
13
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Unique identifier for the note
PKrequiredunique
user_id uuid Author of the note (peer mentor or coordinator)
required
contact_id uuid Optional contact the note is associated with
-
organization_id uuid Tenant scope for multi-tenant isolation
required
title string Short note title or subject
-
body text Encrypted note body content (AES-256-GCM at application layer)
required
is_pinned boolean Whether the note is pinned to the top of the author's list
required
is_sensitive boolean Marks the note as containing sensitive content triggering screen reader readout warning
required
tags json Free-form tags array for categorisation and search
-
visibility enum Who can see the note
required
created_at datetime Timestamp of note creation
required
updated_at datetime Timestamp of last modification
required
deleted_at datetime Soft-delete timestamp; null for active notes
-
sync_status enum Offline sync state for outbox reconciliation
required
client_generated_id string Client-side UUID used for ID mapping when note is created offline
unique

Database Indexes

idx_notes_user_id
btree

Columns: user_id

idx_notes_contact_id
btree

Columns: contact_id

idx_notes_org_user_updated
btree

Columns: organization_id, user_id, updated_at

idx_notes_client_generated_id
btree unique

Columns: client_generated_id

idx_notes_deleted_at
btree

Columns: deleted_at

Validation Rules

body_required_non_empty error

Validation failed

body_max_length error

Validation failed

title_length_limit error

Validation failed

contact_id_must_exist error

Validation failed

visibility_enum_check error

Validation failed

encryption_required error

Validation failed

Business Rules

author_scoped_visibility
always

Private notes are only visible to the authoring user; coordinator_shared visibility surfaces them to coordinators of the same organization

tenant_isolation
always

Notes are strictly scoped by organization_id; cross-tenant reads are rejected

soft_delete_only
on_delete

Notes are soft-deleted by setting deleted_at to preserve audit trail; hard-delete reserved for retention sweeps

Enforced by: Note ServiceNote Store
sensitive_readout_warning
on_update

When is_sensitive=true, the screen reader prompts confirmation before reading note body aloud

offline_outbox_capture
on_create

Notes created or modified offline are queued in the sync outbox with a client_generated_id and reconciled on reconnect

audit_logging
always

Create, update, and delete operations on notes emit audit log entries scoped to the organization

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
by_user
Retention
Permanent Storage