audit PK: id 7 required 1 unique

Description

Audit record tracking when a peer mentor opens and reads an encrypted assignment, providing delivery confirmation and read receipt functionality for coordinators dispatching sensitive personal information.

9
Attributes
4
Indexes
4
Validation Rules
10
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
assignment_id uuid Foreign key to the assignment that was read
required
user_id uuid Foreign key to the peer mentor who read the assignment
required
read_at datetime Timestamp when the peer mentor first opened and read the assignment
required
device_info json Device metadata at time of read (platform, OS version, app version) for audit trail completeness
-
ip_address string IP address from which the read occurred, for security audit purposes
-
is_first_read boolean Whether this is the first time this user read this assignment (subsequent opens are also recorded but flagged)
required
read_count integer Cumulative number of times this user has opened this assignment
required
created_at datetime Record creation timestamp
required

Database Indexes

idx_assignment_reads_assignment_id
btree

Columns: assignment_id

idx_assignment_reads_user_id
btree

Columns: user_id

idx_assignment_reads_assignment_user
btree

Columns: assignment_id, user_id

idx_assignment_reads_read_at
btree

Columns: read_at

Validation Rules

valid_assignment_reference error

Validation failed

valid_user_reference error

Validation failed

read_at_not_future error

Validation failed

read_count_positive error

Validation failed

Business Rules

read_receipt_on_open
on_create

A read record must be created the first time a peer mentor opens an encrypted assignment. This provides the coordinator with delivery confirmation.

threshold_check_on_read
on_create

After each new first-read record is created, the assignment threshold service must re-evaluate whether the cumulative assignment count for this user's organization has crossed a billing/honor threshold (e.g., 3rd assignment triggers office fee, 15th triggers higher rate for Blindeforbundet).

immutable_read_record
on_update

Read records cannot be modified after creation. They are append-only audit records. Only the read_count may be incremented on subsequent opens.

auto_reminder_on_unread
always

If no read record exists for an assignment after 10 days, the notification system must trigger an automatic reminder to the peer mentor (Blindeforbundet requirement).

one_first_read_per_user_assignment
on_create

Only one record may have is_first_read=true for a given (assignment_id, user_id) pair. Subsequent opens increment read_count on the existing record rather than creating new first-read records.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
by_date
Retention
Permanent Storage