okpy / ok

ok.py supports programming projects by running tests, tracking progress, and assisting in debugging.
Apache License 2.0
331 stars 83 forks source link

feat: add enrollment put/delete API routes #1413

Open chrononyan opened 2 years ago

chrononyan commented 2 years ago

These models still confuse me.

GET /api/v3/course/<offering>/enrollment/<email>

$ curl 'http://127.0.0.1:5000/api/v3/course/cal/cs61a/sp16/enrollment/okstaff@okpy.org?access_token=access1'
{
    "code": 200,
    "data": {
        "class_account": "",
        "role": "staff",
        "section": "",
        "user": {
            "email": "okstaff@okpy.org",
            "id": "asdf"
        }
    },
    "message": "success"
}

DELETE /api/v3/course/<offering>/enrollment/<email> works the same as the frontend batch-enroll-CSV

$ curl 'http://127.0.0.1:5000/api/v3/course/cal/cs61a/sp16/enrollment/okstaff@okpy.org?access_token=token' -X DELETE
{
    "code": 200,
    "data": {},
    "message": "success"
}

PUT /api/v3/course/<offering>/enrollment works the same as the frontend batch-enroll-CSV

$ curl 'http://127.0.0.1:5000/api/v3/course/cal/cs61a/sp16/enrollment?access_token=token' -X PUT -H 'Content-Type: application/json' -d '{"role":"student","csv":"okstaff@okpy.org,Staff,,,"}'
{
    "code": 200,
    "data": {
        "new": 1,
        "updated": 0
    },
    "message": "success"
}