Skip to content

Frontend/update mock data with privilege history#1115

Merged
isabeleliassen merged 12 commits intocsg-org:developmentfrom
InspiringApps:frontend/update-mock-history-data
Oct 14, 2025
Merged

Frontend/update mock data with privilege history#1115
isabeleliassen merged 12 commits intocsg-org:developmentfrom
InspiringApps:frontend/update-mock-history-data

Conversation

@rmolinares
Copy link
Copy Markdown
Collaborator

@rmolinares rmolinares commented Sep 26, 2025

Requirements List

  • None

Description List

  • Update mock data: practitioner privilege details + history response
  • Refactor mock data API to include all practitioners dynamically

Testing List

  • yarn test:unit:all should run without errors or warnings
  • yarn serve should run without errors or warnings
  • yarn build should run without errors or warnings
  • Code review
  • Testing
    • Using mock data
    • Log in as a practitioner and view privilege details and confirm that the history timeline makes sense
      • Update authenticatedProviderUserId in mock.data.api to 'log in' as the other mock practitioners and confirm those as well
      • Note: Jane Doe purposefully has incomplete details
    • Log in as compact staff and search licensing data and confirm that the practitioner who you are viewing has privilege details history timeline that make sense
    • Log out and search health providers public details and confirm that those users also have privilege details history timelines that make sense

Closes #1082

Summary by CodeRabbit

  • New Features

    • Privilege history now reflects the signed-in provider via a unified license-type mapping and dynamic authenticated-provider lookup.
  • Improvements

    • Much larger, more realistic mock dataset: new providers, jurisdictions, license types, and explicit privilege IDs.
    • Richer multi-step privilege timelines (issuance, renewals, expirations, encumbrances, jurisdiction changes) with dynamic relative dates.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 26, 2025

Walkthrough

Replaces hard-coded provider/jurisdiction branches with a licenseTypeMap-driven dynamic lookup using an authenticatedProviderUserIndex; expands and updates mock privilege histories and provider entries with new licenseType/privilegeId values and moment-based relative dates across multiple jurisdictions.

Changes

Cohort / File(s) Summary
Mock API lookup logic
webroot/src/network/mocks/mock.data.api.ts
Added LicenseType import and licenseTypeMap; introduced authenticatedProviderUserIndex and getAuthenticatedProvider(); replaced hard-coded provider/jurisdiction branches with a unified find() over mockPrivilegeHistoryResponses for public, staff, and licensee privilege-history endpoints; updated getAuthenticatedLicenseeUser to use the provider index; preserved existing error responses and timing.
Mock data expansion and date localization
webroot/src/network/mocks/mock.data.ts
Converted many privilege entries to include explicit licenseType and new privilegeId values; added numerous provider privilege records and richer event histories (issuance, renewals, deactivations, encumbrances/lifting_encumbrances, home-jurisdiction changes, notes); replaced many static dates with moment-based relative calculations and adjusted activeSince/status values; no public API signature changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant MockAPI as Mock API
  participant Map as licenseTypeMap
  participant Data as mockPrivilegeHistoryResponses

  Client->>MockAPI: getPrivilegeHistory*(providerId, jurisdiction, licenseTypeAbbrev)
  MockAPI->>Map: resolve licenseType = licenseTypeMap[licenseTypeAbbrev]
  MockAPI->>Data: find(entry => entry.providerId==providerId && entry.jurisdiction==jurisdiction && entry.licenseType==licenseType)
  alt match found
    Data-->>MockAPI: matched history entry
    MockAPI-->>Client: return responseData (with wait)
  else no match
    MockAPI-->>Client: throw "not found" (after wait)
  end

  Note over MockAPI: Public / Staff / Licensee flows reuse same lookup\ngetAuthenticatedLicenseeUser -> getAuthenticatedProvider() uses authenticatedProviderUserIndex
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • jlkravitz
  • jsandoval81
  • carlsims

Poem

I nibble through mocks beneath moonlight,
Mapping licenses, dates, and flight.
Histories stitched with carrot cheer,
New hops and hops of test-time cheer. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the main change by highlighting the update of mock data to include privilege history, directly reflecting the core purpose of this pull request.
Linked Issues Check ✅ Passed The changes refactor the mock data API to dynamically retrieve the correct practitioner and update mockPrivilegeHistoryResponses with comprehensive event histories for the five mock users, directly addressing issue #1082’s requirement to stabilize and align privilege history data.
Out of Scope Changes Check ✅ Passed All modifications are confined to the mock data and its API layer to support dynamic privilege history retrieval, with no unrelated production code or configuration changes introduced.
Description Check ✅ Passed The PR description follows the repository template by providing Requirements, Description, and Testing sections and includes all mandatory commands along with detailed manual testing steps, and it correctly references Closes #1082.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab45efa and 76adc15.

📒 Files selected for processing (2)
  • webroot/src/network/mocks/mock.data.api.ts (6 hunks)
  • webroot/src/network/mocks/mock.data.ts (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
webroot/src/network/mocks/mock.data.api.ts (2)
webroot/src/network/mocks/mock.data.ts (2)
  • mockPrivilegeHistoryResponses (1527-1911)
  • licensees (426-1177)
webroot/src/models/LicenseeUser/LicenseeUser.model.ts (1)
  • LicenseeUserSerializer (47-62)
webroot/src/network/mocks/mock.data.ts (1)
webroot/src/app.config.ts (1)
  • serverDateFormat (157-157)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CheckWebroot

Comment thread webroot/src/network/mocks/mock.data.api.ts Outdated
Comment thread webroot/src/network/mocks/mock.data.ts
Comment thread webroot/src/network/mocks/mock.data.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
webroot/src/network/mocks/mock.data.ts (1)

535-539: Align OTA-NE-11 update timestamp with its newest history event

Line 537 still reports dateOfUpdate as seven months ago, but the matching history sequence (Lines 1713-1718) records the most recent renewal two months back. Carrying the older timestamp into the privilege record causes the privilege detail pane to disagree with the history timeline. Please sync the privilege metadata with the latest event.

-                    dateOfUpdate: moment().subtract(7, 'months').format(serverDateFormat),
+                    dateOfUpdate: moment().subtract(2, 'months').format(serverDateFormat),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76adc15 and f3d38f0.

📒 Files selected for processing (1)
  • webroot/src/network/mocks/mock.data.ts (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
webroot/src/network/mocks/mock.data.ts (1)
webroot/src/app.config.ts (1)
  • serverDateFormat (157-157)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CheckWebroot

Comment thread webroot/src/network/mocks/mock.data.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3d38f0 and 1e4ab39.

📒 Files selected for processing (1)
  • webroot/src/network/mocks/mock.data.ts (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
webroot/src/network/mocks/mock.data.ts (1)
webroot/src/app.config.ts (1)
  • serverDateFormat (157-157)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CheckWebroot
🔇 Additional comments (1)
webroot/src/network/mocks/mock.data.ts (1)

1731-1734: Fix OTA-OH-12 history effective date mismatch

Line 1732 still subtracts an extra year from effectiveDate/createDate, so the timeline shows issuance ≈21 months ago while the privilege record on Line 553 reports 9 months. That contradiction reintroduces the accuracy bug we flagged earlier. Align the timestamps with the privilege metadata.

-                effectiveDate: moment().subtract(9, 'months').subtract(1, 'year').format(serverDateFormat),
-                createDate: moment().subtract(9, 'months').subtract(1, 'year').format(serverDateFormat)
+                effectiveDate: moment().subtract(9, 'months').format(serverDateFormat),
+                createDate: moment().subtract(9, 'months').format(serverDateFormat)

Comment thread webroot/src/network/mocks/mock.data.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
webroot/src/network/mocks/mock.data.ts (1)

543-558: Correct licenseType for OTA-OH-12
In webroot/src/network/mocks/mock.data.ts, for privilegeId 'OTA-OH-12', change licenseType in both the privileges array and the mockPrivilegeHistoryResponses entry from 'occupational therapist' to 'occupational therapy assistant'.

🧹 Nitpick comments (2)
webroot/src/network/mocks/mock.data.ts (2)

871-875: Use 'months' for consistency with Moment units.

Minor: other calls use 'months'. Prefer the plural for consistency.

-                    dateOfExpiration: moment().add(3, 'month').format(serverDateFormat),
+                    dateOfExpiration: moment().add(3, 'months').format(serverDateFormat),

1528-1904: Optional: centralize date offsets to avoid future drift

To prevent privilege vs history inconsistencies, consider constants/helpers (e.g., issuanceOffset('OTA-AL-10')) or generating history from privilege metadata in mocks.

I can provide a small utility to derive history arrays from privilege objects to keep dates in sync.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e4ab39 and bf46df1.

📒 Files selected for processing (1)
  • webroot/src/network/mocks/mock.data.ts (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
webroot/src/network/mocks/mock.data.ts (1)
webroot/src/app.config.ts (1)
  • serverDateFormat (157-157)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CheckWebroot
🔇 Additional comments (10)
webroot/src/network/mocks/mock.data.ts (10)

539-541: LGTM: activeSince now tracked for OTA-NE-11

Adding activeSince aligns the privilege with renewal timing and improves timeline accuracy.


979-987: LGTM: normalized licenseType on OCTP-AL-19

The licenseType now matches OTA data and the history entry. Good.


1055-1061: LGTM: OCTP-AL-22 privilege metadata synced to renewal

dateOfUpdate/dateOfRenewal now align with the renewal event. This addresses the earlier discrepancy.


1124-1173: Confirm intent: active statuses with past expirations for Jane Doe

These privileges are marked active but have dateOfExpiration in 2023/2024. If intentional for demo (per notes about incomplete details), ignore; otherwise adjust either status or expiration to avoid contradictory UI.

Do you want me to normalize these to prevent “Active but expired” states in the timeline?


1528-1557: LGTM: OTA-NE-10 history now matches privilege issuance (2y7m)

Issuance timestamps align with the privilege record; this fixes the timeline inconsistency.


1656-1688: LGTM: OTA-AL-10 event sequence consistent with privilege metadata

Issuance, expiration, renewal, encumbrance, and lifting events line up with the privilege’s update/renewal/activeSince fields.


1701-1718: LGTM: OTA-NE-11 history coheres with privilege fields

Issuance (2y7m) and renewals (1y7m, 2m) are consistent with dates on the privilege.


1819-1830: LGTM: OCTP-AL-19 history deactivation flows correctly

Issuance then deactivation sequence is clear and matches the privilege’s inactive status.


1849-1853: LGTM: OCTP-AL-22 renewal history aligns with privilege metadata

Renewal timing matches the privilege block updates.


1863-1901: LGTM: New issuance histories for Jane (AL/AK/AR)

PrivilegeIds and licenseType fields are consistent; minimal, clean histories.

Comment thread webroot/src/network/mocks/mock.data.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (7)
webroot/src/network/mocks/mock.data.ts (2)

871-875: Minor: use plural time unit for consistency

Prefer 'months' for consistency with the rest of the file.

-                    dateOfExpiration: moment().add(3, 'month').format(serverDateFormat),
+                    dateOfExpiration: moment().add(3, 'months').format(serverDateFormat),

1638-1643: Normalize mixed date formats within the same event

effectiveDate uses YYYY-MM-DD while dateOfUpdate/createDate use ISO with time. Inconsistent formats can cause parsing/ordering surprises.

Consider standardizing all three fields to the same format (either serverDateFormat everywhere for date-only events or full ISO timestamps consistently).

webroot/src/network/mocks/mock.data.api.ts (5)

46-48: Rename/match testing instructions; consider storing providerId instead of index

Docs say “update authenticatedProviderUserId”, but code exposes authenticatedProviderUserIndex. Rename for clarity; storing the actual providerId and resolving via find() avoids index brittleness when the provider list changes.

-// Authenticated provider index for the current session
-const authenticatedProviderUserIndex = 0;
+// Authenticated provider ID for the current session (defaults to first provider)
+const authenticatedProviderUserId = licensees.providers[0]?.providerId;

Apply corresponding replacements at Lines 491-493 and 571-573:

- .fromServer(licensees.providers[authenticatedProviderUserIndex])
+ .fromServer(licensees.providers.find(p => p.providerId === authenticatedProviderUserId) ?? licensees.providers[0])
- const authenticatedUser = licensees.providers[authenticatedProviderUserIndex];
+ const authenticatedUser = licensees.providers.find(p => p.providerId === authenticatedProviderUserId) ?? licensees.providers[0];

311-360: DRY: factor shared history-lookup + response shaping

The three history endpoints duplicate the same find/shape code. Extract a small helper to reduce drift.

Example helper:

  • findHistory(providerId, jurisdiction, licenseTypeAbbrev)
  • buildHistoryResponse(responseData)

Also applies to: 365-416, 566-612


491-493: Authenticated user selection still index-based

Safe for now, but brittle if provider ordering changes. Consider the ID-based approach in the earlier comment when convenient.


318-337: Optional: also validate mappedLicenseType presence before building response

Helps return a clean “not found” instead of matching against undefined.

-        if (responseData
+        if (responseData
             && compact
             && providerId
             && jurisdiction
             && licenseTypeAbbrev
         ) {
+            // proceed
         } else {
             response = wait(500).then(() => {
                 throw new Error('not found');
             });
         }

50-53: If enum values don’t match, map to strings instead (fallback)

If verification shows LicenseType enum values differ from the mock strings, switch mapping to strings to keep mock lookups working.

-const licenseTypeMap = {
-    ot: LicenseType.OCCUPATIONAL_THERAPIST,
-    ota: LicenseType.OCCUPATIONAL_THERAPY_ASSISTANT
-};
+const licenseTypeMap = {
+    ot: 'occupational therapist',
+    ota: 'occupational therapy assistant'
+} as const;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf46df1 and ef8cf0c.

📒 Files selected for processing (2)
  • webroot/src/network/mocks/mock.data.api.ts (6 hunks)
  • webroot/src/network/mocks/mock.data.ts (9 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-21T15:23:26.019Z
Learnt from: rmolinares
PR: csg-org/CompactConnect#1025
File: webroot/src/models/Licensee/Licensee.model.ts:242-254
Timestamp: 2025-08-21T15:23:26.019Z
Learning: In the CompactConnect codebase, the LicenseSerializer.fromServer() method maps the server response field `dateOfIssuance` to the License model's `issueDate` property. After serialization, License instances only contain `issueDate` and never have `dateOfIssuance`. When reviewing date comparisons in reducers that work with License objects, check if they're working with serialized License instances (which use `issueDate`) rather than raw server data (which uses `dateOfIssuance`).

Applied to files:

  • webroot/src/network/mocks/mock.data.ts
🧬 Code graph analysis (2)
webroot/src/network/mocks/mock.data.api.ts (2)
webroot/src/network/mocks/mock.data.ts (2)
  • mockPrivilegeHistoryResponses (1527-1904)
  • licensees (426-1177)
webroot/src/models/LicenseeUser/LicenseeUser.model.ts (1)
  • LicenseeUserSerializer (47-62)
webroot/src/network/mocks/mock.data.ts (1)
webroot/src/app.config.ts (1)
  • serverDateFormat (157-157)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CheckWebroot
🔇 Additional comments (11)
webroot/src/network/mocks/mock.data.ts (10)

550-558: OTA-OH-12 licenseType/date fixes look consistent — LGTM

licenseType set to occupational therapy assistant and issuance/renewal/update aligned at 9 months with matching activeSince/expiration.


979-987: OCTP-AL-19 licenseType corrected to OTA — LGTM


1055-1061: OCTP-AL-22: licenseType + renewal metadata sync — LGTM


1528-1557: NE/OTA-NE-10 history block aligns with privilege metadata — LGTM


1701-1718: NE/OTA-NE-11 issuance and renewals look coherent — LGTM


1722-1736: OH/OTA-OH-12 issuance history aligned to 9 months — LGTM


1769-1783: OH/OT-OH-11 deactivation sequence — LGTM


1816-1831: AL/OCTP-AL-19 issuance + deactivation — LGTM


1841-1853: AL/OCTP-AL-22 renewal matches privilege metadata — LGTM


1863-1870: AL/AK/AR one-off issuance entries for provider 4 — LGTM

webroot/src/network/mocks/mock.data.api.ts (1)

50-53: licenseTypeMap mappings are correct
Enum values for OCCUPATIONAL_THERAPIST and OCCUPATIONAL_THERAPY_ASSISTANT resolve to “occupational therapist” and “occupational therapy assistant,” matching the mock historyEntry.licenseType strings.

Comment thread webroot/src/network/mocks/mock.data.api.ts
Comment thread webroot/src/network/mocks/mock.data.api.ts
Comment thread webroot/src/network/mocks/mock.data.api.ts Outdated
@rmolinares rmolinares requested review from jsandoval81 and removed request for jsandoval81 September 26, 2025 20:57
Comment thread webroot/src/network/mocks/mock.data.api.ts Outdated
@rmolinares rmolinares requested review from jsandoval81 and removed request for jsandoval81 September 26, 2025 21:00
@rmolinares
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 26, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
webroot/src/network/mocks/mock.data.api.ts (5)

46-48: Align variable name with testing instructions (add alias).

Test checklist says to edit authenticatedProviderUserId, but the code defines authenticatedProviderUserIndex. Add an alias to prevent confusion.

Apply this diff:

-// Authenticated provider index for the current session
-const authenticatedProviderUserIndex = 0;
+// Authenticated provider index for the current session
+const authenticatedProviderUserIndex = 0;
+// Back-compat with testing checklist naming
+const authenticatedProviderUserId = authenticatedProviderUserIndex;

49-54: Comment says “abbreviations and full names” but map only covers abbreviations.

Either update the comment or expand the map to actually accept full names as well.

Apply this diff to correct the comment (minimal change):

-// License type mapping for matching abbreviations and full names to LicenseType enum values
+// License type mapping for matching abbreviations to LicenseType enum values

319-330: Also filter by compact to avoid cross‑compact collisions.

You require compact but don’t use it in the predicate. Add it to the match to prevent false positives when multiple compacts exist.

Apply this diff:

-            const matches = Boolean(
+            const matches = Boolean(
                 historyEntry.providerId === providerId
                 && historyEntry.jurisdiction === jurisdiction
-                && historyEntry.licenseType === mappedLicenseType
+                && historyEntry.licenseType === mappedLicenseType
+                && historyEntry.compact === compact
             );

373-385: Repeat compact filtering for staff lookup.

Same as public endpoint—use the compact param to disambiguate results.

Apply this diff:

-            const matches = Boolean(
+            const matches = Boolean(
                 historyEntry.providerId === providerId
                 && historyEntry.jurisdiction === jurisdiction
-                && historyEntry.licenseType === mappedLicenseType
+                && historyEntry.licenseType === mappedLicenseType
+                && historyEntry.compact === compact
             );

491-493: Guard against invalid index to avoid serializer crashing.

If the index is out of bounds (or later edited), this will pass undefined to the serializer. Add a safe fallback or throw a clear error.

Apply this diff:

-        return wait(500).then(() => LicenseeUserSerializer
-            .fromServer(licensees.providers[authenticatedProviderUserIndex]));
+        return wait(500).then(() => {
+            const user = licensees.providers[authenticatedProviderUserIndex] ?? licensees.providers[0];
+            if (!user) { throw new Error('not found'); }
+            return LicenseeUserSerializer.fromServer(user);
+        });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef8cf0c and 396bcb0.

📒 Files selected for processing (1)
  • webroot/src/network/mocks/mock.data.api.ts (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-10T19:50:56.745Z
Learnt from: jsandoval81
PR: csg-org/CompactConnect#922
File: webroot/src/components/UserAccount/UserAccount.ts:0-0
Timestamp: 2025-07-10T19:50:56.745Z
Learning: In the UserAccount component (webroot/src/components/UserAccount/UserAccount.ts), the email field should be disabled for staff users (`isDisabled: this.isStaff`) to maintain existing restrictions, while licensees should be able to change their email address through the new verification process. This is the intended behavior per PR #922 requirements.

Applied to files:

  • webroot/src/network/mocks/mock.data.api.ts
🔇 Additional comments (1)
webroot/src/network/mocks/mock.data.api.ts (1)

32-32: LGTM: LicenseType import is appropriate for the new mapping.

Comment thread webroot/src/network/mocks/mock.data.api.ts Outdated
Copy link
Copy Markdown
Collaborator

@jsandoval81 jsandoval81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels solid and is nice to have things matching up with the mocks 👍

Just a minor item below about comments / notation.

Comment thread webroot/src/network/mocks/mock.data.ts
@rmolinares
Copy link
Copy Markdown
Collaborator Author

@jlkravitz This is now ready for your review.

Copy link
Copy Markdown
Collaborator

@jlkravitz jlkravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, but otherwise looks great!

Comment thread webroot/src/network/mocks/mock.data.api.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
webroot/src/network/mocks/mock.data.api.ts (1)

46-63: Excellent DX improvement!

This helper implements the console error approach discussed in previous reviews, providing clear feedback when the index is out of bounds. The bounds checking and fallback logic are solid.

Based on learnings

Optional: Guard against empty providers array

While unlikely in mock data context, you could add a defensive check:

 const getAuthenticatedProvider = () => {
     const { providers } = licensees;
+    
+    if (!providers || providers.length === 0) {
+        console.error('Mock Data Error: No providers available in mock data.');
+        return undefined;
+    }
+    
     const maxIndex = providers.length - 1;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40c0343 and 7fa2875.

📒 Files selected for processing (1)
  • webroot/src/network/mocks/mock.data.api.ts (6 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
webroot/src/network/mocks/mock.data.api.ts (2)
webroot/src/network/mocks/mock.data.ts (2)
  • licensees (426-1177)
  • mockPrivilegeHistoryResponses (1527-1943)
webroot/src/models/LicenseeUser/LicenseeUser.model.ts (1)
  • LicenseeUserSerializer (47-62)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CheckWebroot
🔇 Additional comments (6)
webroot/src/network/mocks/mock.data.api.ts (6)

32-32: LGTM!

Clean import addition for the license type mapping.


65-69: LGTM!

Clean and maintainable mapping from abbreviations to enum values. The lowercase keys align well with the case-insensitive lookup pattern used throughout.


335-346: Dynamic lookup cleanly replaces hard-coded branches.

The refactoring successfully implements a mapping-driven approach that scales better and is easier to maintain. The safe string coercion String(licenseTypeAbbrev ?? '').toLowerCase() correctly handles null/undefined inputs.

Based on learnings


389-401: LGTM!

Consistent implementation of the dynamic lookup pattern. The staff endpoint correctly mirrors the public endpoint logic.


507-508: LGTM!

Clean usage of the getAuthenticatedProvider() helper, centralizing the authenticated provider resolution.


584-600: Safe authenticated user resolution.

The optional chaining authenticatedUser?.providerId correctly prevents crashes when the provider index is invalid, allowing the flow to degrade gracefully to "not found". The dynamic lookup pattern is consistent with the public and staff endpoints.

Based on learnings

Copy link
Copy Markdown
Collaborator

@jlkravitz jlkravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isabeleliassen good to merge!

@isabeleliassen isabeleliassen merged commit 3e67b28 into csg-org:development Oct 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update mock history data FE

4 participants