Skip to content

Conversation

@Ang-m4
Copy link
Contributor

@Ang-m4 Ang-m4 commented Dec 1, 2025

Description

This pull request adds all the necessary logic to add and remove courses from a catalog.
It introduces a new catalog_course service that handles course position ordering, bulk additions, and bulk removals of courses in a catalog.

Key changes

  • Added two new endpoints to manage catalog courses:
    • POST /manage/catalogs/<id>/add_courses
    • POST /manage/catalogs/<id>/remove_courses
  • Created two new schemas to document how to use both endpoints.
  • Added the necessary policy checks to validate that new catalog course additions are valid, complying with the organization logic and base catalog logic.
  • Removed the POST (create) catalog course from the CatalogCourseEnrollmentView, since all catalog course additions will now go through the /add_courses endpoint.
  • Updated the PATCH/PUT endpoint at /manage/catalogs/<catalog_id>/courses/<course_id> to allow updating the position of a single course within a catalog.

How to test

  1. Go to the Swagger UI http://local.openedx.io:8000/partner_catalog/swagger
  2. Call POST /manage/catalogs/<id>/add_courses with a list of valid course IDs that belong to the catalog’s organization.
    • Verify in the response that the courses are now listed under that catalog.
  3. Try adding a course that does not belong to the catalog’s organization:
    • The request should fail with a validation/policy error.
  4. Call POST /manage/catalogs/<id>/remove_courses with one or more course IDs already associated.
    • Verify that those courses are removed from the catalog in the response.
  5. Use PATCH or PUT on /manage/catalogs/<catalog_id>/courses/<course_id>:
    • Update the position field of a course.
    • Verify that the new position is reflected in the response.

@Ang-m4 Ang-m4 marked this pull request as ready for review December 1, 2025 22:28
@Ang-m4 Ang-m4 requested a review from Alec4r December 1, 2025 22:28
@Ang-m4 Ang-m4 changed the title [WIP] feat: add catalog courses service and update policies feat: add catalog courses service and update policies Dec 1, 2025
@Ang-m4 Ang-m4 force-pushed the afg/learner-views branch from 8ea0be2 to 3afdd6b Compare December 2, 2025 15:37
@Ang-m4 Ang-m4 changed the base branch from afg/learner-views to main.v2 December 2, 2025 15:56
@Ang-m4 Ang-m4 force-pushed the afg/catalog-courses-logic branch from 29ad464 to ba25c97 Compare December 2, 2025 15:57
@Ang-m4 Ang-m4 merged commit d498d7e into main.v2 Dec 2, 2025
4 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.

3 participants