This documentation describes when different pages are displayed based on user subscription status.
| Page | Route | Conditions |
|---|---|---|
| Main Listing Page | /{uniqueCode} |
|
| Paused Subscription Page | /{uniqueCode}/paused-subscription |
|
| Renew Subscription Page | /{uniqueCode}/renew-subscription |
|
| Root Page (Fallback) | / |
|
// Validation flow pseudocode
function validateUser() {
if (!uniqueCode) → redirect to /
if (!isValid) → redirect to /
if (!isPreconception) → redirect to /
if (!isActiveSubscription) → redirect to /{uniqueCode}/renew-subscription
if (isPaused) → redirect to /{uniqueCode}/paused-subscription
else → show main listing page (/{uniqueCode})
}Contains user information including unique code, phase, and booked programs
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| user_code | String | Unique identifier code |
| phase | String | Current program phase |
| name | String | User's name |
| String | User's email | |
| booked_programs | Array | Contains program objects with dates and phase |
| Step | Process | Result |
|---|---|---|
| 1 | User visits page with unique code | System extracts uniqueCode from URL |
| 2 | System validates uniqueCode against database | User record is retrieved if code exists |
| 3 | System checks user's phase | Confirms if user is in preconception phase |
| 4 | System checks subscription status | 1. Sorts booked programs by updated_at field (most recent first) 2. Checks if current date is between program_start_date and program_end_date 3. Checks if stage is 'PAUSED' for paused subscriptions 4. Checks if stage is 'PLAN_EXPIRED' for expired subscriptions |
| 5 | System routes to appropriate page | User sees content based on their status |
When determining subscription status, booked programs are sorted in the following priority:
The system follows these sequential steps to determine subscription status:
| Field | Type | Description |
|---|---|---|
| isActiveSubscription | boolean | True if current date is between program_start_date and program_end_date |
| isPaused | boolean | True if user's stage is 'PAUSED' |
| isPlanExpired | boolean | True if user's stage is 'PLAN_EXPIRED' |