refactor: migrate Studio Home courses caller to standardized v4 API (FC-0118)#3139
Conversation
…FC-0118) FC-0118 (ADR 0028/0037): point the Studio Home course list at the new standardized `/api/contentstore/v4/home/courses/` endpoint instead of v2. The v4 `HomeCoursesViewSet` is served by a DRF DefaultRouter, so the URL now carries the required trailing slash. The default (full) payload shape is unchanged, so this is a behaviour-preserving swap for the paginated caller. The deprecated non-paginated v1 `home/courses` fallback (`getStudioHomeCourses`) had no remaining callers and is removed; pagination, filtering, and ordering are handled natively by v4. Test mocks updated to expect the v4 URL. Refs openedx#3127 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks for the pull request, @taimoor-ahmed-1! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3139 +/- ##
==========================================
+ Coverage 95.76% 95.77% +0.01%
==========================================
Files 1396 1396
Lines 33308 33396 +88
Branches 7820 7603 -217
==========================================
+ Hits 31897 31985 +88
- Misses 1352 1367 +15
+ Partials 59 44 -15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
⛔ Draft — blocked by #2540 (do not merge yet)
This PR is intentionally opened as a draft. It is item #3 of the FC-0118
Studio-API caller migration tracked in #3127,
and it is on hold pending #2540 (the "Studio Home" Redux → React Query +
Context refactor). #2540 intends to break the kitchen-sink Studio Home state
(course list, library list, permissions, feature flags, branding) into smaller,
purpose-specific queries; versioning the courses endpoint as-is would entrench a
payload shape we plan to remove. Do not merge until #2540's direction is settled.
Merge order / dependencies
v1 → v3PR (item [BD-03] [BB-2542] ]Add discussions configuration UI wireframe in MFE #2 of Migrate Studio API callers to standardized v3/v4 endpoints (FC-0118) #3127) alsoedits
src/studio-home/data/api.ts. These two should be reviewed together;whichever merges first, the other must rebase. Suggested order: Course Home
([BD-03] [BB-2542] ]Add discussions configuration UI wireframe in MFE #2) first, then this one.
Description
Migrates the Studio Home course list caller from the deprecated v2 endpoint
to the standardized v4 endpoint (FC-0118, ADR 0028/0037):
getStudioHomeCoursesV2now targetsGET /api/contentstore/v4/home/courses/instead of
…/v2/home/courses. The v4HomeCoursesViewSetis served by a DRFDefaultRouter, so the URL now carries the required trailing slash.home/coursesfallback(
getStudioHomeCourses) had no remaining callers and is removed.Pagination, filtering, and ordering are handled natively by v4.
The default (full) response shape is unchanged between v2 and v4 (ADR 0036
?view=presets are opt-in and default to the full payload), so this is abehaviour-preserving swap for the paginated caller.
Supporting information
HomeCoursesViewSetregistered athome/coursesviaDefaultRouterincms/djangoapps/contentstore/rest_api/v4/urls.py.Testing instructions
npm cinpx jest src/studio-homeand orders correctly, and that the network tab shows requests to
/api/contentstore/v4/home/courses/.Other information
src/studio-home/data/api.ts— v4 URL + trailing slash; drop v1 fallback.src/studio-home/data/api.test.js— drop the v1-fallback test; bump thecaller test to v4.
src/studio-home/data/thunks.test.js— bump the courses mock regex to v4.src/studio-home/tabs-section/TabsSection.test.tsx— bump the courses mock URL to v4.src/studio-hometests pass;dprint checkis clean.