core PK: id 7 required 1 unique

Description

Personal notes created by peer mentors and coordinators, optionally linked to a specific contact. Supports free-text content for informal observations, follow-up reminders, and context that doesn't fit structured activity forms.

10
Attributes
5
Indexes
4
Validation Rules
9
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
user_id uuid Author of the note — FK to users
required
contact_id uuid Optional contact this note is about — FK to contacts
-
title string Short title or heading for the note
-
content text Full note body in plain text or simple markdown
required
is_pinned boolean Whether the note is pinned to the top of the list
required
organization_id uuid Tenant scoping — FK to organizations
required
created_at datetime Timestamp when note was created
required
updated_at datetime Timestamp of last edit
required
deleted_at datetime Soft-delete timestamp; null means active
-

Database Indexes

idx_notes_user_id
btree

Columns: user_id

idx_notes_contact_id
btree

Columns: contact_id

idx_notes_organization_id
btree

Columns: organization_id

idx_notes_user_created
btree

Columns: user_id, created_at

idx_notes_deleted_at
btree

Columns: deleted_at

Validation Rules

content_not_empty error

Validation failed

title_max_length error

Validation failed

valid_contact_ref error

Validation failed

user_must_exist error

Validation failed

Business Rules

owner_only_access
always

A note is private to the user who created it. Other users within the same organization cannot read or modify it.

contact_org_match
on_create

If contact_id is set, the referenced contact must belong to the same organization as the note author.

Enforced by: NoteService
soft_delete_only
on_delete

Notes are never hard-deleted; deleted_at is set instead so the record is excluded from list queries but retained for audit.

offline_sync_eligible
on_create

Notes are included in the offline mutation outbox so peer mentors can create and edit notes without connectivity, with sync on reconnect.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage