# TORAZ Backend — Frontend / Backend Field Mapping

**Status:** Grows one module section per recovery batch (plan item P1). Each section is written and checked against the frontend source before that batch's models. Finalized in Recovery 10.

The frontend is the contract for names, types and allowed values (MP §0 rule 2). This document records, field by field, where each frontend field lives in the backend. It is RECONSTRUCTED: the original mapping document was lost.

Frontend paths are relative to `toraz_frontend-master/src/`. The frontend is read only; nothing in it is changed.

| Section | Frontend area | Batch | State |
|---|---|---|---|
| 1 | Authentication (`services/auth`, `lib/validations/auth.ts`, account fields of the registration schema) | Recovery 2 | Written |
| 2 | Profile (`services/profile`, `lib/validations/registration.ts`, `config/registration-options.ts`, the twelve registration sections, Edit Profile) | Recovery 3 | Written |
| 3 | Photos (`ProfilePhoto`, `components/Forms/PhotoUploader.tsx`) | Recovery 3 | Written |
| 4 | What other members may see (`components/Profile/LiveProfilePreview.tsx`, `types/profile.ts`) | Recovery 3 | Written |
| 5 | Discovery and matching (`services/discovery`, `services/matching`, `types/profile.ts`, `mocks/members.ts`, Discover, Matches, Dashboard, public profile) | Recovery 4 | Written (decisions AD-22 to AD-27) |
| 6 | Messages (`services/messages`) | Recovery 5 | Written |
| 7 | Safety (block and report dialogs) | Recovery 6 | Written |
| 8 | Verification (`services/verification`, Verification screen and timeline, `isVerified` readers) | Recovery 7 | Written (decisions AD-47 to AD-54) |
| 9 | Premium (`services/premium`, Premium screen, `Conversation.isPro`) | Recovery 8 | Written (decisions AD-55 to AD-64) |
| 10 | Admin (`services/admin`, `services/admin/users`, admin screens) and the settings counters and Online Activity Indicator (definitions) | Recovery 9 | **Proposed, not approved, not implemented** (`reports/RECOVERY_9_DESIGN_REQUEST.md`) |
| — | Settings (`services/settings`) | Recovery 9B (proposed split, P-01) | Not written |

---

## 1. Authentication (Recovery 2)

Frontend sources checked: `services/auth/types.ts`, `services/auth/mock.ts`, `lib/validations/auth.ts`, `lib/validations/registration.ts` (account fields only), `components/Forms/PhoneInput.tsx`, `components/Forms/OtpInput.tsx`, `app/(auth)/login/LoginScreen.tsx`, `app/(auth)/register/sections/AccountSection.tsx`.

### 1.0 Service methods

| Frontend method (`AuthService`) | Backend route |
|---|---|
| `requestOtp(input: RequestOtpInput)` | `POST /api/auth/request-otp` |
| `verifyOtp(input: VerifyOtpInput)` | `POST /api/auth/verify-otp` |
| `resendOtp(requestId: string)` | `POST /api/auth/resend-otp` |
| none | `POST /api/auth/refresh`, `POST /api/auth/logout`, `GET /api/auth/me` |

### 1.1 Request fields (frontend → backend)

| Frontend field | Frontend type | Backend field | MongoDB type | Required | Validation | Allowed values | Visibility | Create API | Update API | Read API |
|---|---|---|---|---|---|---|---|---|---|---|
| `RequestOtpInput.countryCode` | `string` | `OtpRequest.countryCode`, then `User.countryCode` | String | yes | exact match | `+91` | owner, admin | `POST /api/auth/request-otp` | none | `GET /api/auth/me` |
| `RequestOtpInput.phoneNumber` | `string` | `OtpRequest.phoneNumber`, then `User.phoneNumber` | String | yes | `^\d{10}$` (frontend `phoneNumberSchema`) | 10 digits | masked only | `POST /api/auth/request-otp` | none | `GET /api/auth/me` (masked) |
| `RequestOtpInput.channel` | `"sms" \| "whatsapp"`, optional | `OtpRequest.channel` | String | no (default `sms`) | enum | `sms`, `whatsapp` | internal | `POST /api/auth/request-otp` | none | none |
| `VerifyOtpInput.requestId` | `string` | `OtpRequest.requestId` | String | yes | `^[a-f0-9]{32}$` | — | requester | generated by the server | none | returned by request-otp |
| `VerifyOtpInput.code` | `string` | compared with `OtpRequest.codeHash`; never stored | — | yes | `^\d{6}$` (frontend `otpCodeSchema`) | 6 digits | never | — | — | never |
| `resendOtp(requestId)` | `string` argument | `OtpRequest.requestId` | String | yes | `^[a-f0-9]{32}$` | — | requester | — | `POST /api/auth/resend-otp` | — |

### 1.2 Response fields (backend → frontend)

| Frontend field | Frontend type | Backend source | Notes |
|---|---|---|---|
| `RequestOtpResult.requestId` | `string` | `OtpRequest.requestId` | |
| `RequestOtpResult.expiresInSeconds` | `number` | constant resend cooldown, 30 | The frontend passes it to the resend countdown. The 5-minute validity is separate and enforced on the server (gap C6) |
| `RequestOtpResult.maskedPhoneNumber` | `string` | derived from `phoneNumber` | First five digits, then one `•` per remaining digit, as in the frontend mock |
| `VerifyOtpResult.success` | `true \| false` | HTTP status and envelope `success` | 200 ↔ `true`; 400, 410, 429 with a reason ↔ `false` |
| `VerifyOtpResult.isNewUser` | `boolean` | `User.registrationCompletedAt === null` | `data.isNewUser` (gap C5) |
| `VerifyOtpResult.reason` | `"invalid_code" \| "expired" \| "too_many_attempts"` | `errors.reason` | Exactly these three values |
| `AuthServiceError.code` `"rate_limited"` | — | HTTP 429 without `errors.reason` | |
| `AuthServiceError.code` `"network_error"` | — | transport failure, 5xx, 503 | |

### 1.3 Account fields that appear inside the registration schema

`registrationSchema` (`lib/validations/registration.ts`) carries three account fields in the profile payload. They belong to the account, not the profile. Recovery 3 handles the rest of that schema; the account side is fixed here.

| Frontend field | Frontend rule | Backend field | Write behaviour | Read behaviour |
|---|---|---|---|---|
| `phoneVerified` | must be literal `true` | `User.phoneVerifiedAt` (Date) | **Ignored.** Set only by a successful verify-OTP | `true` when `phoneVerifiedAt` is set |
| `countryCode` | string, default `+91` | `User.countryCode` | **Ignored.** Comes from the authenticated account | from the account |
| `phoneNumber` | 10 digits | `User.phoneNumber` | **Ignored.** Comes from the authenticated account | from the account (gap C9) |

### 1.4 Backend fields with no frontend counterpart

These exist because the backend needs them. None is accepted from a client.

| Backend field | Why it exists | Visibility |
|---|---|---|
| `User.role` | Authorization (MP §5) | owner, admin |
| `User.accountStatus` | Suspension and deletion (MP §5) | admin |
| `User.registrationCompletedAt` | Registration state; source of `isNewUser` (MP §6) | owner, as a boolean |
| `User.lastLoginAt` | Admin "active users" proxy (R01 §5) | admin |
| `OtpRequest.codeHash`, `expiresAt`, `attempts`, `resendCount`, `lastSentAt`, `sentAt`, `consumedAt`, `invalidatedAt`, `purgeAt` | OTP security rules (MP §8) | internal |
| `Session.*` | Revocable refresh sessions (MP §9) | owner in part, from Recovery 9 |
| `data.accessToken`, `data.accessTokenExpiresIn` in verify-otp and refresh | Token delivery (MP §9; R06) | owner |
| `data.user` in verify-otp and `GET /api/auth/me` | Current account summary (MP §8 `GET /api/auth/me`) | owner |

### 1.5 Frontend constants and their backend counterparts

| Frontend constant (`services/auth/mock.ts`) | Value | Backend | Status |
|---|---|---|---|
| `RESEND_COOLDOWN_SECONDS` | 30 | OTP policy `resendCooldownSeconds` | Confirmed by R02 |
| `CODE_TTL_SECONDS` | 300 | OTP policy `ttlSeconds` | Confirmed by R02 |
| `MAX_VERIFY_ATTEMPTS` | 5 | OTP policy `maxVerifyAttempts` | From the frontend mock (gap D7) |
| `MAX_RESENDS` | 5 | OTP policy `maxResends` | From the frontend mock (gap D7) |
| `DEMO_OTP_CODE` | fixed demo value | not copied. `OTP_DEV_FIXED_CODE` is empty by default and forbidden in production | Reconstruction (gap D7) |
| `DEMO_EXISTING_PHONE_NUMBER` | fixed demo value | not copied. Whether a number is new is read from the database | — |
| `COUNTRY_CODES` (`PhoneInput.tsx`) | `+91` only | allowed country codes | From the frontend |

### 1.6 Differences from the frontend mock that a real integration would notice

| Mock behaviour | Backend behaviour | Why |
|---|---|---|
| Resend keeps the same code | Resend issues a new code | A resent code should not extend the life of a possibly exposed one (MP §8) |
| Resend works on any known request, however old | Resend works only on a request that is still active | One-time use and invalidation (MP §8) |
| A new request for the same number leaves earlier ones usable | A new request invalidates earlier ones | MP §8 |
| No limit per number | Hourly and daily caps per number, and a per-IP limit | MP §8 |
| `verifyOtp` returns only `isNewUser` | Also returns the access token and account summary, and sets the refresh cookie | MP §9; R06 |
| The "existing member" is one hard-coded number | Decided by the database | — |

---

## 2. Profile (Recovery 3)

Frontend sources checked, all read in full: `lib/validations/registration.ts`, `config/registration-options.ts`, `services/profile/types.ts`, `services/profile/mock.ts`, `app/(auth)/register/RegistrationScreen.tsx` and all twelve files in `app/(auth)/register/sections/`, `app/(app)/profile/edit/EditProfileScreen.tsx`, `components/Forms/DobField.tsx`, `ChipToggle.tsx`, `VibeTileGroup.tsx`, `OptionCardGroup.tsx`, `PhotoUploader.tsx`, `components/Profile/LiveProfilePreview.tsx`.

### 2.0 Service methods

| Frontend method (`ProfileService`) | Input | Output | Backend route |
|---|---|---|---|
| `registerProfile(input)` | `RegistrationFormValues & { photos }` | `{ profileId }` | `POST /api/profile/me` |
| `saveDraft(input)` | `Partial<RegistrationFormValues> & { photos? }` | `{ savedAt }` | `PUT /api/profile/me/draft` |
| `getCurrentProfile()` | — | `RegistrationFormValues & { photos }` | `GET /api/profile/me` |
| `updateProfile(input)` | `RegistrationFormValues & { photos }` | `{ savedAt }` | `PUT /api/profile/me` |

Errors the frontend already knows: `ProfileServiceError("duplicate_submission")` ↔ 409 on a second registration; `ProfileServiceError("network_error")` ↔ transport failure or 5xx.

### 2.1 The 49 fields

One schema, `registrationSchema`, backs both Registration and Edit Profile. The backend likewise has one profile schema used for registration and update (MP §7). Every one of the 49 fields is mapped below, in the frontend's order. The table was generated from one specification and checked mechanically against the frontend: same 49 names, same order, every option list referenced, every length and count limit identical.

Columns: **Frontend rule** is the Zod rule in `registration.ts`. **Register** is the requirement for registration and update. **Backend validation** is what the server enforces. **Public view** is what another member may ever see (§4).

| Frontend field | Frontend rule | Backend field | MongoDB type | Register | Backend validation | Allowed values | Public view |
|---|---|---|---|---|---|---|---|
| `phoneVerified` | literal true | `User.phoneVerifiedAt` | Date | ignored on write | not accepted | — | no |
| `countryCode` | string, default +91 | `User.countryCode` | String | ignored on write | not accepted | — | no |
| `phoneNumber` | 10 digits | `User.phoneNumber` | String | ignored on write | not accepted | — | no |
| `fullName` | trim, 2–80 | `Profile.fullName` | String | required | trim, 2–80 | — | first name only |
| `dob` | {day 1–31, month 1–12, year ≥1900}, real date, age 18–99 | `Profile.dob` | Date (UTC midnight) | required | same; numbers or numeric strings | — | age only, if allowed |
| `gender` | enum | `Profile.gender` | String | required | enum | `genderOptions` | no (used internally from Recovery 4) |
| `genderSelfDescribe` | trim, ≤60, optional | `Profile.genderSelfDescribe` | String | optional | trim, ≤60 | — | no |
| `sexualOrientation` | string, optional | `Profile.sexualOrientation` | String | optional | "" or option | `orientationOptions` | no |
| `showOrientationOnProfile` | boolean, default true | `Profile.showOrientationOnProfile` | Boolean | default true | boolean | — | no |
| `pronouns` | string, optional | `Profile.pronouns` | String | optional | "" or option | `pronounOptions` | no |
| `pronounsCustom` | trim, ≤40, optional | `Profile.pronounsCustom` | String | optional | trim, ≤40 | — | no |
| `country` | string, default India (input disabled) | `Profile.country` | String | default India | trim, ≤60 | — | no |
| `state` | trim, min 1 | `Profile.state` | String | required | trim, 1–80 | — | no |
| `city` | trim, min 1 | `Profile.city` | String | required | trim, 1–80 | — | yes |
| `hometown` | trim, ≤80, optional | `Profile.hometown` | String | optional | trim, ≤80 | — | no |
| `datingIntention` | enum | `Profile.datingIntention` | String | required | enum | `datingIntentionOptions` | yes, unless hidden by settings |
| `otherPreferences` | string[], default [] | `Profile.otherPreferences` | [String] | default [] | unique options | `otherPreferenceOptions` | no |
| `interestedIn` | enum | `Profile.interestedIn` | String | required | enum | `interestedInOptions` | no (used internally from Recovery 4) |
| `relationshipStatus` | string, min 1 | `Profile.relationshipStatus` | String | required | option | `relationshipStatusOptions` | no |
| `haveChildren` | string, optional | `Profile.haveChildren` | String | optional | "" or option | `haveChildrenOptions` | no |
| `wantChildren` | string, optional | `Profile.wantChildren` | String | optional | "" or option | `wantChildrenOptions` | no |
| `openToPartnerWithKids` | string, optional | `Profile.openToPartnerWithKids` | String | optional | "" or option | `partnerWithKidsOptions` | no |
| `heightCm` | integer 120–230, optional; "" → unset | `Profile.heightCm` | Number | optional | same; number or numeric string | — | no |
| `bodyType` | string, optional | `Profile.bodyType` | String | optional | "" or option | `bodyTypeOptions` | no |
| `activityLevel` | string, optional | `Profile.activityLevel` | String | optional | "" or option | `activityLevelOptions` | no |
| `starSign` | string, optional | `Profile.starSign` | String | optional | "" or option | `starSignOptions` | no |
| `diet` | string[], default [] | `Profile.diet` | [String] | default [] | unique options | `dietOptions` | no |
| `drinking` | string, optional | `Profile.drinking` | String | optional | "" or option | `drinkingOptions` | no |
| `smoking` | string, optional | `Profile.smoking` | String | optional | "" or option | `smokingOptions` | no |
| `pets` | string[], default [] | `Profile.pets` | [String] | default [] | unique options | `petOptions` | no |
| `languages` | string[], min 1 | `Profile.languages` | [String] | required, ≥1 | unique options, ≥1 | `languageOptions` | no |
| `profession` | trim, ≤100, optional | `Profile.profession` | String | optional | trim, ≤100 | — | yes |
| `company` | trim, ≤100, optional | `Profile.company` | String | optional | trim, ≤100 | — | no |
| `educationLevel` | string, optional | `Profile.educationLevel` | String | optional | "" or option | `educationLevelOptions` | no |
| `university` | trim, ≤100, optional | `Profile.university` | String | optional | trim, ≤100 | — | no |
| `workCities` | trim, ≤100, optional (no input in the UI) | `Profile.workCities` | String | optional | trim, ≤100 | — | no |
| `religion` | trim, ≤60, optional | `Profile.religion` | String | optional | trim, ≤60 | — | no |
| `showReligionOnProfile` | boolean, default false | `Profile.showReligionOnProfile` | Boolean | default false | boolean | — | no |
| `politicalViews` | trim, ≤60, optional | `Profile.politicalViews` | String | optional | trim, ≤60 | — | no |
| `showPoliticalOnProfile` | boolean, default false | `Profile.showPoliticalOnProfile` | Boolean | default false | boolean | — | no |
| `interests` | string[], 3–10 | `Profile.interests` | [String] | required, 3–10 | unique options, 3–10 | `interestOptions` | yes |
| `vibeTags` | string[], ≤3 | `Profile.vibeTags` | [String] | default [] | unique options, ≤3 | `vibeOptions` | yes |
| `bio` | trim, 20–500 | `Profile.bio` | String | required | trim, 20–500 | — | yes |
| `promptQuestion` | string, optional | `Profile.promptQuestion` | String | optional | "" or option | `promptOptions` | no |
| `promptAnswer` | trim, ≤200, optional | `Profile.promptAnswer` | String | optional | trim, ≤200 | — | no |
| `privacy` | object of 4 booleans, each default true | `Profile.privacy` | embedded object | required object | 4 booleans, each default true | — | no (applied, never shown) |
| `safetyPledgeAccepted` | literal true | `Profile.consents.safetyPledgeAcceptedAt` | Date | must be true | literal true | — | no |
| `termsAccepted` | literal true | `Profile.consents.termsAcceptedAt` | Date | must be true | literal true | — | no |
| `privacyAcknowledged` | literal true | `Profile.consents.privacyAcknowledgedAt` | Date | must be true | literal true | — | no |

### 2.2 Rules that apply across fields

| Rule | Detail | Basis |
|---|---|---|
| Empty string means "not set" | The frontend's selects use `<option value="">` and its single-choice chips send `""` when deselected. An optional text or choice field therefore accepts `""` (or only spaces, for text) or a value; `""` is stored as absent. `heightCm` also accepts `null`, as the frontend's preprocess does. `country`, whose input is disabled, takes `India` when missing or `""` in registration and update | `AboutMeSection`, `AppearanceLifestyleSection`, `ChipToggle.tsx` |
| Option lists | All 22 choice fields (16 single, 6 multiple) are checked against the frontend's own lists, copied into `src/config/profileOptions.js` by a script, not by hand. The frontend schema checks only 3 of them itself; the other 19 are gap D5. A list with no frontend maximum is capped at its own length | Gap D5 default |
| No duplicates | A multi-choice array may not contain the same value twice | The frontend's chips cannot produce one |
| Numbers from forms | `dob` parts and `heightCm` are accepted as whole numbers or strings of digits. The frontend's `z.coerce` is looser (it would also turn `true` into 1); the backend is not | `registration.ts` |
| Age | 18 to 99 inclusive on the server's date (UTC) | `registration.ts` |
| Unbounded frontend strings | `country`, `state`, `city` have no frontend maximum; the backend caps them (60, 80, 80) | Reconstruction choice: MP §6 requires length validation |
| Unknown fields | Dropped, including `photos`, `role`, `userId`, `profileCompletion` | MP §0 rule 3; gap C9 |
| Account fields | `phoneVerified`, `countryCode`, `phoneNumber` are never taken from the body; on read they come from the account | Gap C9 |
| Consents | Must be `true` to register and to update. Stored as the time of first acceptance and returned as `true` | `registration.ts`; DPDP-style record of consent |
| Update is a full replacement | `updateProfile` sends the whole form, so an optional field missing from an update is cleared | `EditProfileScreen.tsx` |
| Draft is partial | `saveDraft` sends what has been filled in. Only shape rules apply (types, options, maximum lengths and counts); minimums and required fields do not. A date of birth, if sent, must still be a real date of someone aged 18 to 99: a draft may leave it out but cannot store one that could never be registered. Consents are not stored from a draft | `RegistrationScreen.tsx` "Save & Finish Later" |
| At least one photo | Registration and update need at least one photo already uploaded | `validatePhotos()`; Edit Profile's save check |

### 2.3 Read shape: `GET /api/profile/me`

Returns `CurrentProfile` = the 49 fields + `photos`, plus one backend field:

| Field | Source |
|---|---|
| `phoneVerified`, `countryCode` | the account |
| `phoneNumber` | the account, **unmasked**, to its owner only. The frontend's form requires a full 10-digit number to pass validation on save, so the owner must receive it |
| `dob` | `{ day, month, year }` rebuilt from the stored date |
| optional strings and `heightCm` | omitted when not set |
| arrays | `[]` when empty |
| consents | `true` when recorded |
| `photos` | `ProfilePhoto[]` (§3) |
| `profileCompletion` | **backend-derived**, 0–100. Not in the frontend type; extra fields are harmless to it. MP §7 requires profile completion |

**Profile completion** is derived from the same 15 checks the registration screen uses for its progress bar (`RegistrationScreen.tsx`, `progressPercent`): phone verified; full name; date of birth; gender; state and city; dating intention; interested in; relationship status; at least one language; at least three interests; a bio of at least 20 characters; at least one photo; the three consents. Percentage = checks met ÷ 15, rounded.

---

## 3. Photos (Recovery 3)

### 3.1 `ProfilePhoto`

| Frontend field | Type | Backend source | Notes |
|---|---|---|---|
| `id` | `string` | `Photo._id` | |
| `url` | `string` | `/api/photos/<id>` | The frontend comment expects "a CDN URL". The backend returns a path on the API instead (§3.3) |
| `isPrimary` | `boolean` | `Photo.isPrimary` | Exactly one primary while any photo exists |

### 3.2 `PhotoUploader.tsx` behaviour and the backend equivalent

| Frontend behaviour | Value | Backend |
|---|---|---|
| Accepted types | `image/jpeg`, `image/png`, `image/webp` | Same three, decided by the file's signature, not its declared type |
| Maximum file size | 10 MB | `MAX_FILE_SIZE_MB=10` (decision AD-18) |
| Maximum photos | 5 (`maxPhotos` default) | 5, enforced by the database |
| First photo | becomes primary | Same |
| Make primary | the chosen one becomes the only primary | Same, one operation |
| Remove the primary | the next photo becomes primary | The oldest remaining photo becomes primary |
| EXIF and GPS | "a real backend would … strip EXIF/GPS metadata server-side" | Every photo is re-encoded; no metadata survives |

### 3.3 Known integration point, not resolved here

Photos are served by an authenticated route. A browser `<img>` element cannot send a bearer token, so a future frontend integration will need either a cookie-carried credential or short-lived signed URLs for images. That is a frontend-integration decision (out of scope, R01 §10); gap D6 records it.

A second detail for the same decision: the security headers (Helmet defaults, Recovery 1) include `Cross-Origin-Resource-Policy: same-origin`. If the frontend and the API are served from different sites, a browser will refuse to show these images until that header is relaxed for the photo route. It is left strict until the integration decides how images are fetched.

---

## 4. What other members may see (Recovery 3)

`components/Profile/LiveProfilePreview.tsx` is titled "How matches see you" and says it "automatically mirrors your active privacy settings". It shows: the first word of `fullName`; the age only if `privacy.showExactAge`; the city; an approximate distance only if `privacy.showApproxDistance`; the dating intention label; the bio; the interests; the primary photo. `MemberCard` (`types/profile.ts`) adds `profession`, `vibeTags`, the gallery, online state and verification.

The backend's public view of a profile is exactly that set, after the effective privacy rule (API contract §7) is applied:

| Public field | Backend source | Withheld when |
|---|---|---|
| `firstName` | first word of `Profile.fullName` | never |
| `age` | from `Profile.dob` | effective "show exact age" is off → `null` |
| `city` | `Profile.city` | never |
| `profession` | `Profile.profession` | never (absent if not set) |
| `datingIntention` | `Profile.datingIntention` | the settings control "Intent & Dietary Privacy" is on and the viewer is not a match → `null` |
| `bio`, `interests`, `vibeTags` | `Profile` | never |
| photos | `Photo` | the profile is not viewable at all (§6.4 of the API contract) |

Everything else in the profile is never part of another member's view: full name, date of birth, phone, gender, orientation, pronouns, state, hometown, family, appearance, lifestyle, languages, company, education, beliefs, prompt, privacy flags, consents.

---

## 5. Discovery and matching (Recovery 4)

Frontend sources read in full: `services/discovery/index.ts` and `mock.ts`, `services/matching/index.ts` and `mock.ts`, `types/profile.ts`, `mocks/members.ts`, `services/premium/types.ts` and `mock.ts`, `services/settings/types.ts`, `app/(app)/discover/DiscoverScreen.tsx`, `app/(app)/matches/MatchesScreen.tsx`, `app/(app)/dashboard/DashboardScreen.tsx`, `app/(app)/profile/[id]/page.tsx` and `PublicProfileScreen.tsx`, `components/Profile/ProfileCard.tsx` and `ProfileActionBar.tsx`.

The questions raised before coding (`docs/reports/RECOVERY_4_DECISION_REQUEST.md`) were answered on 2026-10-09 as decisions AD-22 to AD-27.

### 5.0 Service methods

| Frontend method | Input | Output | Backend route |
|---|---|---|---|
| `discoveryService.getRecommended()` | — | `MemberCard[]` | `GET /api/discovery` |
| `discoveryService.getFeatured()` | — | `MemberCard` | `GET /api/discovery/featured` |
| `discoveryService.search(filters)` | `DiscoveryFilters` | `MemberCard[]` | `GET /api/discovery?…filters` |
| `discoveryService.getById(id)` | member ID | `MemberCard \| null` | `GET /api/discovery/members/:memberId` |
| `matchingService.getMatches()` | — | `MemberCard[]` | `GET /api/matching/matches` |
| `matchingService.getLikedYou()` | — | `MemberCard[]` | `GET /api/matching/liked-you` |
| `matchingService.like(memberId)` | member ID | `{ relationship }` | `POST /api/matching/:memberId/like` |
| `matchingService.superLike(memberId)` | member ID | `{ relationship }` | `POST /api/matching/:memberId/super-like` (also returns `superLikesRemaining`) |
| `matchingService.pass(memberId)` | member ID | `{ relationship }` | `POST /api/matching/:memberId/pass` |
| *(none)* | — | — | `DELETE /api/matching/:memberId/pass`: revoke a pass (AD-27; backend only) |
| *(none)* | — | — | `DELETE /api/matching/:memberId/like`: withdraw a like before a match (AD-27; backend only) |
| *(none)* | — | — | `GET /api/matching/super-likes/balance`: the ledger balance, until Recovery 8 builds `PremiumEntitlement` |
| `premiumService.getEntitlement()` | — | `PremiumEntitlement` | Recovery 8. Its `superLikesRemaining` will be the ledger balance built here (AD-22) |

The frontend services return bare arrays. The backend answers lists in the paginated envelope (`data` + `pagination`, MP §12 "use pagination"); a frontend adapter takes `data`. `getById` is called by a Next.js server component (`profile/[id]/page.tsx`), which has no browser bearer token: how it authenticates is a frontend-integration point, like photo fetching (gap D6).

The frontend has **no** method to revoke a pass, withdraw a like, unmatch, list passed members or list sent Super Likes. Matches has "Super Likes" and "Sent Notes" tabs that show a fixed empty state; no backend route is built for them.

### 5.1 `DiscoveryFilters`

| Frontend field | Sent by the UI today? | Backend query parameter | Rule |
|---|---|---|---|
| `ageMin` | No (the panel says it "will apply once the backend filtering API is connected") | `ageMin` | Integer 18–99; the viewer's own filter, not a stored preference |
| `ageMax` | No | `ageMax` | Integer 18–99, ≥ `ageMin` |
| `distanceKm` | No | `distanceKm` | Integer 1–1000. Every distance is unknown, and unknown distances pass the filter (AD-24), so it excludes nobody |
| `onlineOnly` | **Yes, and `true` by default** | `onlineOnly` | `true` or `false`. From Recovery 5, `true` keeps only members shown as `online` (AD-25, AD-34). Because the Discover screen sends `true` by default, it shows only members connected at that moment. That default is the frontend's, not the backend's. **Decided (AD-37):** the frontend is to default to `false` in a future, separately approved integration change; until then it still sends `true` (`API_CONTRACT.md` §8.5) |
| `datingIntention` | No | `datingIntention` | One of `datingIntentionOptions` |
| `query` | Yes (free text, sent on Enter) | `query` | Trimmed, at most 60 characters; matched literally (no regular-expression meaning), case-insensitive, against first name, city and profession, as the mock does. The input's placeholder also mentions "star sign, or interest"; the mock does not search those and neither does the backend |

### 5.2 `MemberCard`

The card is built from the Recovery 3 public view (`toPublicProfile()`, §4) and adds the fields below. Every field is named; nothing else can reach another member.

| Frontend field | Type | Backend source | Notes |
|---|---|---|---|
| `id` | `string` | `User._id` (gap D1) | The account ID, never the profile ID |
| `firstName` | `string` | public view | |
| `age` | `number` | public view | **`null` when the owner hides the exact age** (AD-26, AD-19). The frontend type says `number`; left for frontend integration |
| `city` | `string` | public view | |
| `distanceKm` | `number` | — | Always the unknown sentinel **`-1`** (AD-24): no coordinates are collected, so no distance exists. `-1` means unknown, not 0 km. Never estimated from cities |
| `profession` | `string` | public view | `""` when not set (the type requires a string) |
| `isVerified` | `boolean` | `Verification` (§8) | Until Recovery 7: `false`. From Recovery 7: `true` only for trusted verification (`API_CONTRACT.md` §13.6), from one batched read per list. Not fabricated |
| `isOnline` | `boolean` | presence (Recovery 5) | `true` exactly when the member has a connected socket **and** effective privacy shows their online status (`API_CONTRACT.md` §11.6) |
| `lastActiveLabel` | `string?` | — | Omitted: there is no presence or activity record yet |
| `primaryPhoto` | `string` | `Photo` (primary) | `/api/photos/<id>` |
| `gallery` | `string[]` | `Photo` | Every photo URL in upload order, the primary included, as in the mock |
| `datingIntentionLabel` | `string` | public view + `optionLabel()` | `""` when withheld by effective privacy (cannot happen before Settings exist, Recovery 9) |
| `interests` | `string[]` | public view | |
| `bio` | `string` | public view | |
| `vibeTags` | `string[]` | public view + `optionLabel()` | Labels, as in the mock (gap D19) |
| `relationship` | `RelationshipState` | `Like` records, sealed into a `Match` | §5.3 |
| `compatibilityPercent` | `number?` | — | Omitted: no approved formula (gap D19). Note: `MatchesScreen` shows `?? 90` when it is missing; that is a frontend fallback, not backend data |
| `sharedInterests` | `string[]?` | both profiles | The overlap of the two interest lists (gap D19) |

### 5.3 `RelationshipState`

Always computed by the backend from the database, for the viewer and the member shown. Never taken from the client (MP §14).

| Value | When |
|---|---|
| `matched` | A Match exists for the pair |
| `super_liked` | No match; the viewer's like to the member is a Super Like |
| `liked` | No match; the viewer has liked the member |
| `liked_you` | No match; the member has liked the viewer, and the viewer has neither liked nor passed them (AD-27) |
| `none` | Otherwise, including when the viewer passed the member |
| `pending` | In the type but used by no mock, screen or service. **Never returned** (AD-27 item 8) |

### 5.4 What the screens do with the results

| Screen | Behaviour relied on |
|---|---|
| Discover | Calls `search({ onlineOnly, query })`; removes a card after like, Super Like or pass; shows "It's a match!" when `relationship === "matched"` |
| Dashboard | `getRecommended()`, first four |
| Matches | `getMatches()` and `getLikedYou()`; "like back" moves the member to Matches when the answer is `matched` |
| Public profile | `getById(id)`; 404 page when `null`; like and Super Like buttons |
| Cards | Render `{city} • {distanceKm} km away` and `{firstName}, {age}`. With the approved values these read "Pune • -1 km away" for every card, and "Asha, " for a member who hides their age (AD-24, AD-26). **Known display limitation for frontend integration**; the frontend is not changed |

---

## 6. Messaging (Recovery 5)

Source: FE `services/messages/{types,mock,index}.ts`, `app/(app)/messages/MessagesScreen.tsx`, `components/Messaging/{ConversationItem,MessageBubble}.tsx`. Contract: `API_CONTRACT.md` §10 and §11. Decisions AD-32 to AD-36. The frontend still uses its mock; nothing here is wired.

### 6.0 Service methods

| Frontend method | Backend | Notes |
|---|---|---|
| `getConversations()` | `GET /api/messages/conversations` | Paginated by page number (`page` 1–1000, `limit` 1–50, default 20; no cursor). The method takes no arguments, so it would receive the first page only, and its Unread/Waiting filters and total unread would undercount beyond 20 conversations. Needs a separately approved frontend change (gap D27; `API_CONTRACT.md` §10.2) |
| `getMessages(conversationId)` | `GET /api/messages/conversations/:conversationId` | Newest page, oldest→newest; `before` loads older pages. The method takes no cursor, so it would receive the newest page |
| `sendMessage(conversationId, text)` | `POST /api/messages/conversations/:conversationId/messages` | Body `{ text }`; optional `clientMessageId` is a backend addition |
| — | `PATCH /api/messages/:messageId/read` | No frontend method; backend only |
| — | Socket.IO (`API_CONTRACT.md` §11) | No frontend client exists |

### 6.1 `Conversation`

| Frontend field | Type | Backend source | Notes |
|---|---|---|---|
| `id` | `string` | `Conversation._id` | Random; not the Match ID (R4-03). Mock uses `conv-aarav` |
| `memberId` | `string` | the other member's `User._id` | Mock uses a slug; the backend uses account IDs everywhere (D1) |
| `memberName` | `string` | public view `firstName` | **First name only.** The mock shows full names ("Aarav Mehta"); full names are not shared with other members anywhere (Recovery 3) |
| `memberPhoto` | `string` | primary `Photo` | `/api/photos/<id>`, or `""` |
| `onlineState` | `OnlineState` | presence | §11.6 of the contract; `offline` when effective privacy hides it |
| `isVerified` | `boolean` | `Verification` (§8) | Until Recovery 7: `false`. From Recovery 7: the other member's trusted verification (`API_CONTRACT.md` §13.8) |
| `matchedOnLabel` | `string?` | — | **Omitted**: no real source (D19) |
| `lastMessagePreview` | `string` | latest `Message.text` | At most 120 characters; `""` without messages. The "Waiting" filter treats `""` as "no preview" |
| `lastMessageAt` | `string` | latest `Message.createdAt`, else `Conversation.createdAt` | **ISO 8601** (D2). The mock holds display text ("24m ago") and the item renders it verbatim, so an integrated frontend would show the raw ISO string until it formats it. Known integration item |
| `unreadCount` | `number` | count of `Message` to the viewer with `readAt: null` | |
| `isPro` | `boolean` | — | `false` until Recovery 8 (B12) |

### 6.2 `ChatMessage`

| Frontend field | Type | Backend source | Notes |
|---|---|---|---|
| `id` | `string` | `Message._id` | |
| `conversationId` | `string` | `Message.conversationId` | |
| `senderId` | `"me" \| string` | `Message.senderId` | `"me"` for the viewer's own (D3); the bubble aligns on it |
| `text` | `string` | `Message.text` | Rendered as plain text by the bubble |
| `sentAt` | `string` | `Message.createdAt` | **ISO 8601** (D2); the bubble renders it verbatim, same integration item as above |
| `status` | `MessageStatus` | `deliveredAt`, `readAt` | `sent`, `delivered`, `read`. `sending`/`failed` are client states. The bubble does not render status |
| `moderation` | `ModerationStatus` | `Message.moderation` | The hold state: always `clear` in Recovery 5 (no message is held). The bubble's "Under review" never appears. `clear` is **not** a verdict unless `moderationChecked` is `true`; the frontend type has no unchecked value (gap D28; `API_CONTRACT.md` §10.3) |
| — | — | `moderationChecked` | **Backend addition**: `false` in Recovery 5; says no provider checked the message (AD-33) |

### 6.3 Behaviour the screen relies on, and what differs

| Screen behaviour | Backend |
|---|---|
| Opens the first conversation | Conversations ordered by latest activity |
| "Unread" / "Waiting" filters, total unread | `unreadCount` and `lastMessagePreview` are derived per request |
| Appends the returned message; toast when `pending_review` | `sendMessage` answer is the stored `ChatMessage`; `pending_review` cannot occur in Recovery 5 |
| "End-to-end encrypted" banner | **Not true of this design**: messages are stored on the server and pass through server-side moderation (MP §19). Recorded for frontend integration; the frontend is not changed |
| Call buttons gated on `isPro` | `isPro` is `false` until Recovery 8, so the buttons send to `/premium` |
| Matches and profile "Chat" buttons go to `/messages` | No "start conversation" call is needed: the conversation exists from the moment of the Match |

---

## 7. Safety (Recovery 6)

Source: FE `app/(app)/profile/[id]/PublicProfileScreen.tsx`, `app/(app)/settings/SettingsScreen.tsx`, `services/settings/types.ts`, `app/(public)/safety/SafetyScreen.tsx`. Contract: `API_CONTRACT.md` §12. Decisions AD-38 to AD-45. **The frontend has no block or report service; nothing here is wired (gap D29).**

### 7.0 Frontend actions and their backend counterparts

| Frontend | What it does today | Backend |
|---|---|---|
| "Block {name}" dialog on a profile | Toast, then go to `/discover`; no call | `POST /api/users/:memberId/block` |
| Dialog text "won't be able to view your profile or contact you" | — | Hide and freeze both ways (AD-38) |
| Dialog text "This can be undone from Settings" | **Settings has no blocked list or unblock control** | `GET /api/users/blocked` and `DELETE /api/users/:memberId/block` exist; a Settings screen for them is a separately approved frontend change (D29) |
| "Report Profile" dialog | Toast; no reason collected; no call | `POST /api/reports` with `targetType: "profile"`, `targetId` = the member's account ID, no `reason` |
| Dialog text "This won't notify the member" | — | Reports are never shown or announced to the reported member (AD-40) |
| Report a message | **No UI** (Messages screen has no report action) | `targetType: "message"`; recipient only |
| Settings "Blocked Contacts — {blockedCount} total blocked" | Mock count | Count of the caller's own blocks: part of the Recovery 9 settings snapshot |
| Settings "Reported Profiles — {reportedCount} open reports" | Mock count | Count of the caller's `OPEN`/`UNDER_REVIEW` reports: part of the Recovery 9 settings snapshot |

### 7.1 Blocked list item (no frontend type)

| Field | Source | Notes |
|---|---|---|
| `memberId` | `Block.blockedId` | Account ID |
| `firstName` | the member's profile | `""` without a profile |
| `blockedAt` | `Block.createdAt` | ISO (D2) |

No photo (AD-44).

### 7.2 Report answer (no frontend type)

`{ reportId, status, createdAt }`. The frontend's dialog would show its existing toast; nothing about the target is returned.

### 7.3 Held messages in the frontend's types

`ChatMessage.moderation` already includes `pending_review` and `blocked`. `MessageBubble` shows "Under review" for `pending_review`, and nothing special for `blocked`, which a future frontend change may want to label. Recipients never receive held messages (AD-42).

---

## 8. Verification (Recovery 7)

Frontend: `services/verification/{types,index,mock}.ts`, `app/(app)/verification/VerificationScreen.tsx`, `components/Verification/VerificationTimeline.tsx`, and every reader of `isVerified`. Backend: `API_CONTRACT.md` §13, `DATABASE_DESIGN.md` §8.

### 8.1 Calls

| FE method | Backend | Notes |
|---|---|---|
| `getStatus()` | `GET /api/verification/status` | No arguments on either side |
| `startDigilocker()` | `POST /api/verification/start` | No body. No DigiLocker request is made (AD-53). A real DigiLocker flow is a consent redirect; `VerificationStatus` has no field to carry a redirect URL, so a real provider needs a separately approved frontend change |
| `simulateLiveness()` | `POST /api/verification/liveness` | No body; no image or biometric is sent or accepted |
| `retry()` | `POST /api/verification/retry` | The screen's `retry()` handler has no `catch`: a 503 would be an unhandled promise rejection in the current frontend (not changed here) |

### 8.2 `VerificationStatus`

| FE field | Type | Backend source | Rule |
|---|---|---|---|
| `state` | `VerificationState` (10 values) | `Verification.state`, or derived when no record | C1: the ten frontend values are stored as they are. MP §22's five upper-case states are superseded |
| `percentComplete` | `number` | derived | The mock's `STEP_PERCENT` table, exactly (`API_CONTRACT.md` §13.3) |
| `updatedAt` | ISO string | `Verification.stateChangedAt`, or `User.phoneVerifiedAt` | |

Fields that exist in the backend and **never** reach the frontend: `evidence`, `providerName`, `providerRef`, `verifiedAt`, `version`, the record ID.

### 8.3 Screen behaviour against the backend

| Screen rule | Backend |
|---|---|
| Start enabled only in `mobile_verified` | start allowed from `mobile_verified` (and `not_started`) |
| Liveness enabled only in `digilocker_verified` | the same |
| Retry shown in `retry_required` and `failed` | retry allowed from both (AD-47) |
| The mock's "every attempt verifies" | reproduced only in `dev_simulation`, outside production (D21) |
| Status-matrix copy: "Reviewed by our safety desk within 2 hours", "Contact support" | not implemented by the backend (admin review is Recovery 9) |
| Privacy copy: "Zero ID Storage", "Biometric hashes are stored in an air-gapped … vault", "DPDP 2023 Compliant", "Government ID hashes never leave India's sovereign data zone" | The backend stores no ID data and no biometric hash at all. The vault, DPDP and data-residency statements are product and legal claims this backend does not implement or verify |

### 8.4 Elsewhere in the frontend

| FE field | Backend | Batch |
|---|---|---|
| `MemberCard.isVerified` (`ProfileCard`, `PublicProfileScreen`) | trusted verification (`API_CONTRACT.md` §13.8) | Recovery 7 |
| `Conversation.isVerified` (`ConversationItem`, `MessagesScreen`) | the same, for the other member | Recovery 7 |
| `AccountSummary.isDigilockerVerified` (settings) | not built | Recovery 9 |
| `AdminVerificationStatus`, `VerificationQueueItem`, `approveVerification`, `rejectVerification` | not built (C1 mapping and D14 recorded for then) | Recovery 9 |

---

## 9. Premium (Recovery 8)

Frontend: `services/premium/{types,index,mock}.ts`, `app/(app)/premium/PremiumScreen.tsx`, `Conversation.isPro` in `services/messages/types.ts` and `MessagesScreen.tsx`. Backend: `API_CONTRACT.md` §14, `DATABASE_DESIGN.md` §9.

### 9.1 Calls

| FE method | Backend | Notes |
|---|---|---|
| `getEntitlement()` | `GET /api/premium/entitlement` | The screen's initial read has no `catch` (not changed) |
| `purchaseSuperLikePack(packId)` | `POST /api/premium/super-likes/purchase` `{ packId }` | `purchaseKey` is a backend-only addition the frontend does not send (AD-59) |
| `activateBoost(optionId)` | `POST /api/premium/boost/activate` `{ optionId }` | |
| `subscribe(planId)` | `POST /api/premium/subscribe` `{ planId }` | The mock ignores `planId`; the backend validates it |

The screen's three actions catch errors and toast ("Purchase failed", "Couldn't activate Boost", "Payment failed"), so the default 503 shows as a failure toast.

### 9.2 `PremiumEntitlement`

| FE field | Type | Backend source |
|---|---|---|
| `tier` | `"free" \| "premium"` | trusted subscription → `premium`, else `free` |
| `superLikesRemaining` | `number` | Super Like ledger balance (never a stored copy); AD-61 safeguard |
| `boostStatus` | `"inactive" \| "active" \| "expired"` | trusted Boost and the server clock |
| `boostExpiresAt` | `string \| null` | trusted Boost expiry, ISO; kept after expiry, as the mock does |
| `callingEnabled` | `boolean` | `tier === "premium"` (AD-56) |
| `Conversation.isPro` | `boolean` | the **viewer's** `callingEnabled` (B12) |

### 9.3 Catalog fields

| FE field | Backend |
|---|---|
| `SuperLikePack.id`, `count` | catalog (IDs and counts mirrored) |
| `BoostOption.id`, `durationMinutes` | catalog (IDs and minutes mirrored) |
| `SubscriptionPlan.id` | catalog (IDs only; no duration exists in the frontend) |
| `priceLabel`, `perLikeLabel`, `durationLabel`, `billingNote`, `features`, `highlight` | **frontend display only**; never read or stored |

### 9.4 Mock behaviour against the backend

| Mock | Backend |
|---|---|
| Unknown ID: silently unchanged | 400 (D22) |
| Purchase adds `count` | only in development simulation; 503 by default |
| Boost replaces a running one | the same (AD-57), in simulation |
| `subscribe` sets premium and calling, ignores the plan, no expiry | in simulation: the same, but a known plan is required and a second subscribe answers 409 (AD-58) |
| Copy "jump to the front of discovery decks" | not implemented (AD-55) |
| Plan features (weekly Super Likes, monthly Boosts, "See Who Liked You Instantly", "Incognito Browsing Mode") | not implemented (AD-55, AD-56) |
| `AdminUserRecord.tier` | Recovery 9 |

---

## 10. Admin, settings counters and the Online Activity Indicator (Recovery 9) — **10.1 IMPLEMENTED (Recovery 9-D); 10.2 IMPLEMENTED (Recovery 9-C); 10.3 IMPLEMENTED (Recovery 9B)**

> Mapping proposal (revision 2, after design review); nothing below is built and the frontend is unchanged. Types verified in the frontend source: `services/admin/types.ts`, `services/admin/users/types.ts`, `types/profile.ts`, `services/settings/types.ts`. Detail: `docs/reports/RECOVERY_9_DESIGN_REQUEST.md`. Decision status: `IMPLEMENTATION_DECISIONS.md`, "Recovery 9: proposed".

### 10.1 Dashboard (`services/admin/types.ts`, `AdminDashboardScreen.tsx`) — **IMPLEMENTED (Recovery 9-D)**

> Implemented as mapped below under AD-81 and AD-82 (`API_CONTRACT.md` §15.8). Two refinements made at implementation: the `AuditLogEntry.id` row key is opaque (an HMAC, no raw ID); the KPI hints are the definitions listed in §15.8. The frontend is unchanged; the open integration items are in `API_CONTRACT.md` §15.9.

| FE field | FE type (verified) | Proposed backend source |
|---|---|---|
| `AdminKpi.id`, `label` | `string` | the frontend's twelve IDs and labels, fixed server-side |
| `AdminKpi.value` | `string` (required) | formatted count, e.g. `"1,234"`; **`"—"` for the three unsupported KPIs** (P-14; `null` would not match the type) |
| `AdminKpi.hint` | `string?` | a factual definition only; `"Not tracked"` when unsupported. No trends, ratios, forecasts or "urgent" counts |
| *(backend addition)* `supported` | — | `true` / `false`; not declared by the frontend type, ignored at run time |
| `primaryKpis` | 4 × `AdminKpi` | `verification_backlog`, `open_safety_reports`, `moderation_alerts`, `gateway_retries` (unsupported) |
| `memberKpis` | 4 × `AdminKpi` | `total_members`, `new_today` (IST day), `active_users` (approximate), `online_now` (this process, aggregate) |
| `engagementKpis` | 4 × `AdminKpi` | `messages_sent` (24 h, held messages excluded), `boost_triggers` (unsupported), `super_likes` (24 h), `mod_queue_sla` (unsupported) |
| `recentActivity[]` | `AuditLogEntry[]` | ≤ 10 rows (P-15). **Not** an admin audit-log view |
| `AuditLogEntry.id` | `string` | opaque row key |
| `.action` | `string` | "New User Registered", "Verification Completed", **"Safety Report Filed"**, "Account Suspended", "Account Reinstated" |
| `.memberName` | `string` | the member's first name and last initial. For a report, the **reported** member, never the reporter |
| `.category` | `"User Lifecycle" \| "Trust & Safety" \| "Monetization" \| "Moderation" \| "Engagement"` | "User Lifecycle", "Trust & Safety", "Moderation"; never "Monetization" or "Engagement" |
| `.timestampLabel` | `string` | server-formatted relative time |
| `.status` | `"Success" \| "Verified" \| "High Priority" \| "Settled" \| "Active" \| "Suspended"` | "Success", "Verified", "Suspended", and "Active" for a report that is still open. **Never "High Priority" or "Settled"**. Closed reports leave the feed: no union value describes them truthfully |
| "Export Report" button | — | **not backed** (client toast only) |
| Header "Cluster BOM-01 • Healthy" | — | **not backed** (static) |

### 10.2 Users (`services/admin/users/types.ts`, `AdminUsersScreen.tsx`): least privilege (P-09) — **IMPLEMENTED (Recovery 9-C)**

> Implemented as mapped below by `toAdminUserRecord` and `toVerificationQueueItem` (`src/utils/adminSerializers.js`; `API_CONTRACT.md` §15.7), under AD-75, AD-79 and AD-80. `approveVerification` and `rejectVerification` have no route. The `null` type mismatches below remain frontend-integration items; the frontend is unchanged.

| FE field | FE type (verified) | Proposed backend source |
|---|---|---|
| *(which accounts)* | — | registered accounts (`registrationCompletedAt` set) with role `USER`, status `active` or `suspended` |
| `member.id` | `string` | `User._id` |
| `member.firstName` | `string` | first word of `Profile.fullName` (as member cards derive it) |
| `member.age` | `number` | the age **as members would see it**: exact if the member's effective privacy shows it, otherwise **`null`** (AD-26; no admin exception). Type mismatch recorded |
| `member.city` | `string` | `Profile.city` |
| `member.primaryPhoto` | `string` | the primary photo's URL **only if** `visibility.canViewProfileOf({ viewerId: admin, ownerId })` allows it, otherwise **`null`**. **No photo-route bypass**; suspended members therefore have no photo URL. Type mismatch recorded |
| `member.isVerified` | `boolean` | trusted verification (`API_CONTRACT.md` §13.6) |
| `fullName` | `string` | `Profile.fullName` (admin only; members never receive it) |
| `maskedEmail` | `string` | **`null`** (C7: no email exists anywhere). Type mismatch recorded |
| `maskedPhone` | `string` | `User.countryCode` + space + `maskPhoneNumber(User.phoneNumber)` (first five digits, then bullets); the full number is never returned |
| `tier` | `"Free" \| "Premium"` | `"Premium"` iff a **trusted** subscription (§9; simulation never trusted in production) |
| `verificationStatus` | `"verified" \| "pending" \| "retry_required" \| "manual_review" \| "unverified"` | C1 mapping (below the table); untrusted records read as absent |
| `accountStatus` | `"active" \| "suspended"` | `User.accountStatus`; `deleted` accounts not listed |
| `joinedLabel` | `string` | `"Since <Mon YYYY>"` from `User.registrationCompletedAt` |
| Any other profile field, date of birth, the full phone number, photos beyond the visibility rule | — | **not returned**; each would need a documented purpose and an explicit authorization decision |
| `AdminUserFilters.query` | `string?` | escaped substring of `fullName` or `city` (≤ 60 characters) |
| `.verificationStatus`, `.accountStatus` | unions | the same mappings, as filters |
| Users page KPI cards | — | computed by the frontend from the list; with pagination, from the current page only (a frontend-integration item) |
| "Export CSV" | — | **not backed** |
| `suspendUser(id)`, `reinstateUser(id)` | → `AdminUserRecord` | `PATCH /api/admin/users/:userId/status` |
| `VerificationQueueItem.id` | `string` | the member's account ID |
| `.applicantName` | `string` | `Profile.fullName` |
| `.ageCityLabel` | `string` | `"<age> • <city>"`, using the same privacy-respecting age (`"<city>"` alone when hidden) |
| `.verificationType` | `string` | provider name, or `"Not available"` (D14) |
| `.status` | `"Ready for Approval" \| "Name Mismatch" \| "Awaiting Documents"` | always `"Ready for Approval"` (D14) |
| `.attemptCount` | `number` | **`null`: not tracked** (P-08). Type mismatch recorded |
| `.waitLabel` | `string` | relative time since `Verification.stateChangedAt` |
| Queue entries in this build | — | **none**: only real trusted `manual_review` records; never fabricated |
| `approveVerification`, `rejectVerification` | → `AdminUserRecord` | **no route** until an admin-trust policy is approved (AD-51, P-08). The frontend's buttons must not be wired at integration |

The C1 mapping for `verificationStatus`:
- `verified` → `verified`;
- `manual_review` → `manual_review`;
- `retry_required`, `failed` → `retry_required`;
- `not_started`, `mobile_verified` → `unverified`;
- every other state → `pending`.

### 10.3 Settings counters and the Online Activity Indicator — **IMPLEMENTED (Recovery 9B)**

> Delivered by `GET /api/settings/summary`, `GET /api/settings/privacy` and `PATCH /api/settings/privacy` (`API_CONTRACT.md` §16), not by the frontend's whole `getSettings()` snapshot, whose other fields are not approved. `onlineActivityIndicator` reads `true` until the member changes it (an absent setting imposes no restriction).

| FE field | Proposed backend source |
|---|---|
| `AccountSummary.blockedCount` ("N total blocked") | the caller's **own** blocks, counted exactly as `GET /api/users/blocked` lists them (AD-44) |
| `AccountSummary.reportedCount` ("N open reports" under "Reported Profiles") | the caller's **own** reports in `OPEN` or `UNDER_REVIEW`; never reports about the caller |
| `PrivacySettings.onlineActivityIndicator` | stored in `UserSettings` (Recovery 9B). Applied through `effectivePrivacy` together with the profile's `showOnlineStatus`, the more restrictive winning (AD-19, AD-34) |
| Admin view of a member's presence | **none**; only the aggregate `online_now` |

### 10.4 Display Exact Age, sessions and pause — **IMPLEMENTED (Recovery 9B; AD-88, AD-89, AD-93)**

> Delivered by `PATCH /api/settings/privacy`, `GET /api/settings/sessions`, `DELETE /api/settings/sessions/:sessionId` and `POST /api/settings/pause` (`API_CONTRACT.md` §16.4 to §16.6). Frontend unchanged; these are integration notes.

| FE field or call | Backend source |
|---|---|
| `PrivacySettings.displayExactAge` ("If turned off, shows a verified adult badge only") | stored in `UserSettings.privacy.displayExactAge`; reads `true` until changed. Applied through `effectivePrivacy` with the profile's `showExactAge`, the more restrictive winning: `age` is `null` for other members (AD-93). The "verified adult badge" is frontend presentation; the backend sends no badge field |
| `PrivacySettings.intentAndDietaryPrivacy`, `approximateProximity`, `culturalHeritageAndHometown` | **refused** (400): deferred (AD-95) or not approved (AD-94, AD-96). *Corrected 2026-10-23:* the Settings screen calls `updatePrivacy({ [key]: value })`, **one switch per toggle**, so the two approved switches work as they are. Toggling one of these three answers 400; the screen updates its state optimistically and shows "Couldn't update that setting" **without rolling the switch back**, so it would display a value that was never saved. **Integration blocker (frontend):** hide or disable these three rows, or roll back on error. The snapshot also has no stored value to show for them; the backend does not invent one |
| `DeviceSession.id` | the session ID |
| `DeviceSession.deviceLabel` | derived from the stored User-Agent: "Chrome on macOS", "Browser on Windows", "Unknown device" (never the raw string) |
| `DeviceSession.location` | always `""`: no geolocation (D12, AD-88). The frontend renders "{location} • Active now"; with an empty location only the bullet text remains: an integration item |
| `DeviceSession.isCurrent` | the session of the access token that made the request |
| `logOutSession(sessionId)` → `DeviceSession[]` | `DELETE /api/settings/sessions/:sessionId` → `data`: the remaining `DeviceSession[]`, the caller's own session only; 404 otherwise |
| `pauseProfile()` → `{ paused: true }` | `POST /api/settings/pause` with no body → `{ paused: true }`. Resume: the same route with `{ paused: false }`. **Integration blocker (frontend):** the frontend has no resume call or control and no paused state to show, so a member who pauses cannot resume from the app. The backend cannot fix this without inventing behaviour (for example resuming on sign-in), which no decision allows |
| `SettingsSnapshot.sessions` | `GET /api/settings/sessions` (`data`: `DeviceSession[]`) |

### 10.5 Deletion request — **IMPLEMENTED (batch LC-3; AD-97 to AD-102); non-destructive**

> Delivered by the five routes of `API_CONTRACT.md` §17. The frontend is unchanged; every row below is a **deferred integration item**.

| FE call or text | Backend | Integration item |
|---|---|---|
| `requestDeletion()` → `{ requested: true }`, sends no data | `POST /api/settings/deletion/request-code`, then `POST /api/settings/deletion` with `{ requestId, code }` → 201 `{ status: "pending", requestedAt, scheduledPurgeAt }` | The frontend needs a code step (AD-97). It is signed out of every device right after the request |
| Card, dialog and toast: "…purged **within** 30 days" | `scheduledPurgeAt` = `requestedAt` + 30 days, a **waiting period** before eligibility (AD-98); no purge exists | Inaccurate copy: it must say the waiting period, not a deadline |
| (none) deletion status, cancellation | `GET /api/settings/deletion`; `POST .../cancel-code`, `POST .../cancel` | No screen exists |
| (none) restricted mode | every other route answers 409 `{ reason: "deletion_pending" }`; refresh too | The frontend must handle 409 `deletion_pending` |
| `Conversation` (other member's view) | the conversation is omitted while the account is pending | No field to show "pending deletion"; it disappears |
| `AdminUserRecord` | the account stays listed, unchanged | No pending marker field |
