Skip to content

refactor: migrate course_details + grading callers to standardized v3 APIs (FC-0118)#3136

Draft
taimoor-ahmed-1 wants to merge 2 commits into
openedx:masterfrom
taimoor-ahmed-1:taimoor-ahmed/migrate-studio-api-standardized
Draft

refactor: migrate course_details + grading callers to standardized v3 APIs (FC-0118)#3136
taimoor-ahmed-1 wants to merge 2 commits into
openedx:masterfrom
taimoor-ahmed-1:taimoor-ahmed/migrate-studio-api-standardized

Conversation

@taimoor-ahmed-1

Copy link
Copy Markdown

Description

Part of the FC-0118 downstream migration tracked in #3127. Points two of the
Ready Studio API callers at their standardized v3 endpoints. Pure
URL/verb version bumps — no UI or behaviour change for Course Authors.

Commits (one per API, so each can be reviewed / rolled back independently):

  1. course_details → v3getCourseDetails (GET) and updateCourseDetails
    (PUT) now target /api/contentstore/v3/course_details/{course_id}/. The v3
    ViewSet supports the same GET+PUT and returns the same CourseDetailsSerializer
    shape. Both call sites are migrated (schedule-and-details and the duplicate
    in course-outline) so all course-details reads land on v3.
  2. course_grading write → v3 authoring_grading — the save
    (sendGradingSettings) moves from POST v1/course_grading to
    PATCH v3/authoring_grading/{course_id}/, which collapses the old GET+POST
    pair into a single partial_update. Same serializer payload is returned.

Note — grading read stays on v1 (intentional). The v3 authoring_grading
ViewSet only exposes the write (partial_update); it has no GET. So
getGradingSettings remains on v1/course_grading until a v3 read endpoint
exists. This is called out in a code comment.

The trailing slash on both v3 URLs is required — v3 is served by a DRF
DefaultRouter (the v1 APIViews had none). Omitting it would 301-redirect and
drop the request body on PUT/PATCH.

User roles impacted: Course Author (Studio Schedule & Details, Grading
Settings pages). No visible change expected.

Supporting information

Testing instructions

  1. Open a course in Studio → Settings → Schedule & Details. Confirm the page
    loads and saving changes persists (network calls hit .../v3/course_details/<id>/).
  2. Open Settings → Grading. Confirm current grading loads (GET
    .../v1/course_grading/<id>) and that saving persists (PATCH
    .../v3/authoring_grading/<id>/).
  3. npm test — updated suites: ScheduleAndDetails.test.tsx (13 passing),
    GradingSettings.test.jsx (12 passing), course-outline spot-check green.

Other information

  • Depends on the v3 endpoints landing on edx-platform (feat/axim-api_improvements).
    The old versions remain live, so this is safe to merge once v3 is deployed.
  • No migrations, no accessibility impact.

Best Practices Checklist

  • Any new files are using TypeScript — N/A (no new files)
  • Avoid propTypes/defaultProps in new/modified code
  • Tests use initializeMocks from src/testUtils
  • No new Redux state
  • Data loaded via React Query (apiHooks)
  • New i18n messages have description — N/A (no new messages)
  • No ../ added to import paths

Taimoor Ahmed and others added 2 commits July 15, 2026 12:24
FC-0118 (ADR 0037): point the Studio course-details reads/writes at the
new standardized `/api/contentstore/v3/course_details/{course_id}/`
endpoint instead of v1. The v3 ViewSet supports the same GET (retrieve)
and PUT (update) verbs the frontend uses and returns the same
`CourseDetailsSerializer` shape, so this is a behaviour-preserving swap.

The trailing slash is required because v3 is served by a DRF
DefaultRouter (the v1 APIView had no trailing slash); omitting it would
break the PUT via a 301 redirect that drops the request body.

Both call sites are updated so all course_details reads land on v3:
- src/schedule-and-details/data/api.ts (getCourseDetails + updateCourseDetails)
- src/course-outline/data/api.ts (getCourseDetails, duplicate of the above)

Refs openedx#3127

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
FC-0118 (ADR 0031/0037): move the grading-settings write from the legacy
`POST /api/contentstore/v1/course_grading/{course_id}` to the standardized
`PATCH /api/contentstore/v3/authoring_grading/{course_id}/` ViewSet, which
collapses the old GET+POST pair into a single partial_update. The v3 PATCH
returns the same `CourseGradingModelSerializer` payload the v1 POST did, so
the response handling is unchanged.

The read (`getGradingSettings`) intentionally stays on v1: the v3
`authoring_grading` ViewSet only exposes the write (partial_update) and has
no GET, so settings are still fetched from v1 until a v3 read is added.

The trailing slash is required by the DRF DefaultRouter that serves the v3
ViewSet. Test mocks updated to expect PATCH against the v3 URL.

Refs openedx#3127

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 15, 2026
@openedx-webhooks

openedx-webhooks commented Jul 15, 2026

Copy link
Copy Markdown

Thanks for the pull request, @taimoor-ahmed-1!

This repository is currently maintained by @bradenmacdonald.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If 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 PR

Your 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.76%. Comparing base (c1da7f4) to head (cf76b86).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #3136    +/-   ##
========================================
  Coverage   95.76%   95.76%            
========================================
  Files        1396     1396            
  Lines       33308    33312     +4     
  Branches     7820     7566   -254     
========================================
+ Hits        31897    31901     +4     
- Misses       1352     1367    +15     
+ Partials       59       44    -15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@taimoor-ahmed-1
taimoor-ahmed-1 marked this pull request as draft July 15, 2026 14:10
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Jul 15, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

3 participants