Lynton Mortgages

Protection Hub Documentation

System Reference for AI Analysis

Data Model — Complete Database Schema

The platform uses MySQL/TiDB with Drizzle ORM. Below is every table and its fields.

users

Admin users who can access the adviser hub. Only one user (Rob) in production.

FieldTypeDescription
idint (PK)Auto-increment primary key
openIdvarchar(64)Manus OAuth identifier
nametextDisplay name
emailvarchar(320)Email address
roleenum(user, admin)Role — defaults to admin
createdAt, updatedAt, lastSignedIntimestampMetadata timestamps

client_journeys

The core table — one row per client. Contains all journey state, adviser pre-fill data, and application tracking.

FieldTypeDescription
idint (PK)Auto-increment primary key
clientRefvarchar(20)Unique reference (LM-YYYY-###)
secureTokenvarchar(64)Unique token for client access URL
clientNamevarchar(255)Client's full name
clientEmailvarchar(320)Client's email (optional)
clientPhonevarchar(50)Client's phone (optional)
journeyTypeenumnew_mortgage, standalone, review, campaign
mortgagePaymentMonthlydecimalAdviser pre-fill for Risk Snapshot
householdOutgoingsMonthlydecimalAdviser pre-fill for Risk Snapshot
clientEmploymentStatusvarcharAdviser pre-fill for conditional questions
lvReportUrltextURL to LV Risk Reality report PDF
statusenumpending, in_progress, recommendations_sent, proceeded, parked, declined, follow_up
currentStepenumrisk_reality, risk_review, risk_snapshot, education, holding, recommendations, compliance, decision, application, completed
loomVideoUrltextPersonalised recommendation video URL
loomDocsVideoUrltextDocumentation process video URL
recommendationsSummarytextWritten summary of recommendations
applicationStatusenumnot_started, submitted, under_review, gp_requested, awaiting_gp, decision_received, on_risk, declined_by_provider, non_standard_terms
applicationProvidervarcharInsurance provider name
applicationReferencevarcharProvider's application reference
notestextAdviser-only notes
createdByIdintAdmin user who created the journey
createdAt, updatedAttimestampMetadata timestamps

risk_reviews

Stores all questionnaire responses for a client journey.

FieldTypeDescription
idint (PK)Auto-increment
journeyIdintFK to client_journeys
clientNametextName as entered by client
worriedMosttextQ3: Biggest worry
seriousIllnessImpacttextQ4: Financial impact of serious illness
deathImpacttextQ5: Impact of death on family
incomeStopDurationtextQ6: How long could they pay mortgage
employerSickPaytextQ7: Employer sick pay details
statutorySickPayConfirmvarcharQ8: SSP reality check confirmation
otherFinancialSupporttextQ9: Savings and other support
hasExistingPoliciesvarcharQ10: Whether they have existing policies
existingPoliciesStructuredjsonQ11: Structured policy details
priorityMatterstextQ12: What matters most
protectionAttitudetextQ13: Attitude to protection
budgetRangevarcharQ14: Monthly budget range
smokerStatusvarcharQ15: Smoking/nicotine status
healthConditionstextQ16: Existing health conditions
additionalThoughtstextQ17: Additional information
confirmAccuratevarcharQ18: Confirmation
partialResponsesjsonAuto-saved progress (all answers + current step)
completedAttimestampWhen the questionnaire was submitted

declarations

Digital signatures for proceed/park/decline decisions.

FieldTypeDescription
typeenumproceed, parked, decline
signatureNamevarcharClient's typed name
signatureTimestamptimestampWhen they signed
ipAddressvarcharClient's IP
acknowledgedRisksjsonArray of acknowledged risk statements (decline only)

follow_up_reminders

Automated check-in reminders for parked/declined clients.

FieldTypeDescription
reminderTypeenum3_month, 6_month, 12_month
scheduledDatetimestampWhen the reminder is due
statusenumpending, sent, completed, cancelled

activity_logs

Every client interaction is logged for analytics and audit trail.

email_templates

Editable email templates with variable interpolation support.

email_logs

Complete log of all emails sent or attempted, with delivery status tracking.

journey_videos

Pre-recorded video slots that Rob can configure for different points in the client journey (e.g., before "What Worries You" section, before "Your Safety Net" section).

branding_config

White-label branding settings (company name, tagline, logo, colours, font).

campaigns & campaign_recipients

Bulk re-engagement campaign system for reaching out to declined/incomplete clients.

application_status_history

Audit trail of application status changes with timestamps and notes.