Overview
The jøsh database uses PostgreSQL via Prisma ORM. The schema is divided into two main domains:- Legacy Models - Original jmash voting system (Photo, Vote, User, Shot)
- TPO Models - Time/Place/Occasion dating system (TpoUser, TpoDate, TpoMessage)
Schema Configuration
TPO (Dating) Models
TpoUser
Represents users in the dating system with comprehensive onboarding state.Unique identifier
User creation timestamp
Auto-updated on changes
E.164 format phone number (unique)
Current user state:
ONBOARDING, PENDING_REVIEW, APPROVED, REJECTED, BANNEDCurrent onboarding progress:
INTRO_SENTAWAITING_ABOUTAWAITING_PREFERENCESAWAITING_CITYAWAITING_PHOTOSAWAITING_IDCOMPLETE
Free-form text about the user (Q&A format)
Current position in onboarding question sequence
Whether AI requested clarification on current answer
Number of follow-up questions asked
User’s dating preferences (merged with aboutMe)
Legacy field for preferences follow-up
Legacy preferences follow-up counter
User’s current city
AI-generated structured profile with about/preferences sections
Array of Supabase storage paths for user photos
Storage path for driver’s license photo
Name extracted from driver’s license
Age calculated from driver’s license DOB
Height from driver’s license
Relationships
Example
TpoDate
Represents a matched pair with scheduling state and message portal.Unique date identifier
Date creation timestamp
ACTIVE or ENDEDTimestamp when date was ended
Whether direct messaging between users is enabled
Current scheduling state:
PROPOSING_TO_AWAITING_FOR_A_REPLYPROPOSING_TO_BWAITING_FOR_B_REPLYWAITING_FOR_A_ALTERNATIVEWAITING_FOR_B_ALTERNATIVEAGREEDFAILEDESCALATED
Number of scheduling attempts made
Last scheduling message timestamp
When scheduling was escalated to manual intervention
Reason for scheduling failure
Current proposed date/time (e.g., “Saturday, March 8th at 7pm”)
User A’s availability for proposed slot
User B’s availability for proposed slot
Mutually agreed date/time
AI-suggested venue for the date
Relationships
Example
TpoMessage
Stores all messages in the scheduling and relay flows.Unique message identifier
Message timestamp
Associated date record
Sender phone number (or “system” for bot messages)
Recipient phone number (or “system” for incoming user messages)
Message content
Whether message contained profanity/blocked content
Relationships
Example
Legacy (Voting) Models
Photo
Photos used in the original jmash voting system.Unique photo identifier
Upload timestamp
JOSH or JONATHANTotal view count
Overall ELO rating
ELO rating from male voters
ELO rating from female voters
Relationships
Vote
Records user votes between two photos.Unique vote identifier
Voter’s user ID
Which person’s photos were voted on
Left photo in comparison
Right photo in comparison
LEFT or RIGHTDecision time in seconds
Relationships
User
Voters in the jmash system.Unique user identifier
Display name
MALE, FEMALE, or OTHERWhether user completed voting onboarding
Relationships
Shot
Represents dating profile “shots” for featured users.JOSH or JONATHANDisplay name
Social media handle
Current city
Opening line/bio
Profile photo URL
Utility Models
PhotoLabel
AI-generated labels for photos.Ick
User reactions marking photos as “ick”.PhotoTransform
Crop/zoom metadata for photos.BannedUser
Blocked users by ID or IP.MutualLike
Test system for mutual matches.MutualTestUser
Test users for mutual matching.Enums
TpoUserStatus
TpoOnboardingStep
TpoDateStatus
TpoSchedulingPhase
Gender
Side
Person
Common Queries
Get user with all dates
Find active date for user
Get all pending review users
Get date messages in order
Related Documentation
Architecture Overview
System design and technology stack
API Endpoints
REST API reference for all endpoints