Skip to content

fix(platform/api): wrap course content creation in transaction.atomic #648

Description

@payamnj

Problem

CourseContentView.post creates multiple model instances (course content + child lesson/quiz/assignment) without a transaction boundary. If a later write fails (e.g. integrity error), earlier child objects can be left orphaned in the database.

Relevant call site: platform/api/views/courses.pyCourseContentView.post
Serializer write logic: platform/api/serializers/courses.pyCreateCourseContentRequest.to_django_model

Suggestion

Wrap the create path in transaction.atomic at the view or serializer boundary to ensure all writes succeed or none do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions